// GetGravatarID returns the GravatarID field if it's non-nil, zero value otherwise.
180281
func (c *Contributor) GetGravatarID() string {
	if c == nil || c.GravatarID == nil {
		return ""
	}
	return *c.GravatarID
}
757392
func (c *Client) GetGifById(id string) (*Gif, error) {

	// construct and execute the HTTP request
	u := fmt.Sprintf("gifs/%s", id)
	sr := &singleResult{}
	if err := c.makeRequest(u, &url.Values{}, sr); err != nil {
		return nil, err
	}

	return sr.Data, nil
}
344539
func (serv *v2MetadataService) GetDiffID(dgst digest.Digest) (layer.DiffID, error) {
	if serv.store == nil {
		return layer.DiffID(""), errors.New("no metadata storage")
	}
	diffIDBytes, err := serv.store.Get(serv.digestNamespace(), serv.digestKey(dgst))
	if err != nil {
		return layer.DiffID(""), err
	}

	return layer.DiffID(diffIDBytes), nil
}
784961
func (b *BlogRef) GetAvatar() (string, error) {
	return GetAvatar(b.client, b.Name)
}
206900
func (m *Manager) GetAvatarFile(hash string) ([]byte, error) {
	var file struct {
		Hash string
		File []byte
	}

	err := m.getAvatarFileCollection().Find(bson.M{"hash": hash}).One(&file)
	if err == mgo.ErrNotFound {
		return nil, nil
	}
	return file.File, err
}
2662
func (m *Manager) GetByGrant(grant Grant, globalID string) ([]SavedGrants, error) {
	var usersWithGrant []SavedGrants

	if err := m.collection.Find(bson.M{"grants": grant, "globalid": globalID}).All(&usersWithGrant); err != nil {
		return nil, err
	}

	return usersWithGrant, nil
}
313663
func getScsiSerial(devicePath, diskName string) (string, error) {
	exists, err := utilpath.Exists(utilpath.CheckFollowSymlink, "/lib/udev/scsi_id")
	if err != nil {
		return "", fmt.Errorf("failed to check scsi_id existence: %v", err)
	}

	if !exists {
		klog.V(6).Infof("scsi_id doesn't exist; skipping check for %v", devicePath)
		return diskName, nil
	}

	out, err := exec.New().Command(
		"/lib/udev/scsi_id",
		"--page=0x83",
		"--whitelisted",
		fmt.Sprintf("--device=%v", devicePath)).CombinedOutput()
	if err != nil {
		return "", fmt.Errorf("scsi_id failed for device %q with %v", devicePath, err)
	}

	return parseScsiSerial(string(out))
}
156976
func (_class PGPUClass) GetResidentVGPUs(sessionID SessionRef, self PGPURef) (_retval []VGPURef, _err error) {
	_method := "PGPU.get_resident_VGPUs"
	_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
	if _err != nil {
		return
	}
	_selfArg, _err := convertPGPURefToXen(fmt.Sprintf("%s(%s)", _method, "self"), self)
	if _err != nil {
		return
	}
	_result, _err := _class.client.APICall(_method, _sessionIDArg, _selfArg)
	if _err != nil {
		return
	}
	_retval, _err = convertVGPURefSetToGo(_method + " -> ", _result.Value)
	return
}
1113582
func (r *Repository) GetGitRefsURL() string {
	if r == nil || r.GitRefsURL == nil {
		return ""
	}
	return *r.GitRefsURL
}
968931
func GetContainerID(container *v1.ContainerStatus) string {
	i := strings.Index(container.ContainerID, containerShimPrefix)
	if i == -1 {
		return ""
	}
	return container.ContainerID[i+len(containerShimPrefix):]
}
977231
func GetGreasedVersions(supported []VersionNumber) []VersionNumber {
	b := make([]byte, 1)
	_, _ = rand.Read(b) // ignore the error here. Failure to read random data doesn't break anything
	randPos := int(b[0]) % (len(supported) + 1)
	greased := make([]VersionNumber, len(supported)+1)
	copy(greased, supported[:randPos])
	greased[randPos] = generateReservedVersion()
	copy(greased[randPos+1:], supported[randPos:])
	return greased
}
151379
func GetGuid() string {
	b := make([]byte, 48)
	if _, err := io.ReadFull(rand.Reader, b); err != nil {
		return ""
	}
	return getMd5String(base64.URLEncoding.EncodeToString(b))
}
1125770
func LookupGid(groupName string) (gid int, err error) {
	return group.LookupGid(groupName)
}
432112
func (plugin *glusterfsPlugin) getGidTable(className string, min int, max int) (*MinMaxAllocator, error) {
	plugin.gidTableLock.Lock()
	gidTable, ok := plugin.gidTable[className]
	plugin.gidTableLock.Unlock()

	if ok {
		err := gidTable.SetRange(min, max)
		if err != nil {
			return nil, err
		}

		return gidTable, nil
	}

	// create a new table and fill it
	newGidTable, err := NewMinMaxAllocator(0, absoluteGidMax)
	if err != nil {
		return nil, err
	}

	// collect gids with the full range
	err = plugin.collectGids(className, newGidTable)
	if err != nil {
		return nil, err
	}

	// and only reduce the range afterwards
	err = newGidTable.SetRange(min, max)
	if err != nil {
		return nil, err
	}

	// if in the meantime a table appeared, use it
	plugin.gidTableLock.Lock()
	defer plugin.gidTableLock.Unlock()

	gidTable, ok = plugin.gidTable[className]
	if ok {
		err = gidTable.SetRange(min, max)
		if err != nil {
			return nil, err
		}

		return gidTable, nil
	}

	plugin.gidTable[className] = newGidTable

	return newGidTable, nil
}
1203289
func (dbcr *DiskBlockCacheRemote) GetLastUnrefRev(
	_ context.Context, _ tlf.ID, _ DiskBlockCacheType) (
	kbfsmd.Revision, error) {
	panic("GetLastUnrefRev() not implemented in DiskBlockCacheRemote")
}
1313058
func (kl *Kubelet) getPodVolumeDir(podUID types.UID, pluginName string, volumeName string) string {
	return filepath.Join(kl.getPodVolumesDir(podUID), pluginName, volumeName)
}
958336
func getDiskID(pdName string, exec mount.Exec) (string, error) {
	// TODO: replace Get-GcePdName with native windows support of Get-Disk, see issue #74674
	cmd := `Get-GcePdName | select Name, DeviceId | ConvertTo-Json`
	output, err := exec.Run("powershell", "/c", cmd)
	if err != nil {
		klog.Errorf("Get-GcePdName failed, error: %v, output: %q", err, string(output))
		err = errors.New(err.Error() + " " + string(output))
		return "", err
	}

	var data []map[string]interface{}
	if err = json.Unmarshal(output, &data); err != nil {
		klog.Errorf("Get-Disk output is not a json array, output: %q", string(output))
		return "", err
	}

	for _, pd := range data {
		if jsonName, ok := pd["Name"]; ok {
			if name, ok := jsonName.(string); ok {
				if name == pdName {
					klog.Infof("found the disk %q", name)
					if diskNum, ok := pd["DeviceId"]; ok {
						switch v := diskNum.(type) {
						case int:
							return strconv.Itoa(v), nil
						case float64:
							return strconv.Itoa(int(v)), nil
						case string:
							return v, nil
						default:
							// diskNum isn't one of the types above
							klog.Warningf("Disk %q found, but disknumber (%q) is not in one of the recongnized type", name, diskNum)
						}
					}
				}
			}
		}
	}

	return "", fmt.Errorf("Could not found disk number for disk %q", pdName)
}