code: func getMostFreeDatastoreName(ctx context.Context, client *vim25.Client, dsInfoList []*vclib.DatastoreInfo) (string, error) {
  	var curMax int64
  	curMax = -1
  	var index int
  	for i, dsInfo := range dsInfoList {
  		dsFreeSpace := dsInfo.Info.GetDatastoreInfo().FreeSpace
  		if dsFreeSpace > curMax {
  			curMax = dsFreeSpace
  			index = i
  		}
  	}
  	return dsInfoList[index].Info.GetDatastoreInfo().Name, nil
  }
docs: // getMostFreeDatastore gets the best fit compatible datastore by free space.