// Convert a string containing either a group name or a stringified gid into a numeric id)
962234
func groupToGid(group string) (int, error) {
	if group == "" {
		return os.Getgid(), nil
	}

	var (
		err error
		id  int
	)

	// Try and parse as a number, if the error is ErrSyntax
	// (i.e. its not a number) then we carry on and try it as a
	// name.
	if id, err = strconv.Atoi(group); err == nil {
		return id, nil
	} else if err.(*strconv.NumError).Err != strconv.ErrSyntax {
		return 0, err
	}

	ginfo, err := user.LookupGroup(group)
	if err != nil {
		return 0, err
	}
	group = ginfo.Gid

	if id, err = strconv.Atoi(group); err != nil {
		return 0, err
	}

	return id, nil
}
754886
func (g *Group) GoString() string {
	buf := bytes.Buffer{}
	if err := g.Render(&buf); err != nil {
		panic(err)
	}
	return buf.String()
}
734010
func (id BuildID) String() string {
	return fmt.Sprintf("%s/%s/%d", id.Master, id.Builder, id.Number)
}
811940
func (c *ClientupdateCountCall) GroupId(groupId string) *ClientupdateCountCall {
	c.urlParams_.Set("groupId", groupId)
	return c
}
922372
func GenerateIDWithAlg(customIDgenAlg string, payload []byte) (string, error) {
	if customIDgenAlg == "" {
		customIDgenAlg = defaultAlg
	}
	var alg = availableIDgenAlgs[customIDgenAlg]
	if alg.hashFun != nil {
		return alg.hashFun(payload), nil
	}
	return "", fmt.Errorf("Wrong ID generation algorithm was given: %s", customIDgenAlg)
}
610000
func (oid *OID) String() string {
	var l C.OM_uint32
	var p *C.char

	C.helper_gss_OID_desc_get_elements(oid.C_gss_OID, &l, &p)

	return fmt.Sprintf(`%x`, C.GoStringN(p, C.int(l)))
}
404649
func ParseString(id string) (ID, error) {
	i, err := strconv.ParseInt(id, 10, 64)
	return ID(i), err

}
34745
func GetGid(name string) (int, error) {
	switch name {
	case "nobody":
		return NobodyGid, nil

	case "root":
		return RootGid, nil

	default:
		groupInfo, err := user.LookupGroup(name)
		if err != nil {
			return 0, err
		}

		return strconv.Atoi(groupInfo.Gid)
	}
}
1324064
func (sid *Shortid) String() string {
	return fmt.Sprintf("Shortid(worker=%v, epoch=%v, abc=%v)", sid.worker, sid.epoch, sid.abc)
}
279750
func (b Badge) String() string {
	if b.isSet {
		return fmt.Sprintf("set %d", b.number)
	}
	return "preserve"
}
157649
func (n *Notification) String() string {
	return fmt.Sprintf("ID 0x%x %v", n.Id, n.State)
}
1289880
func GetGroupIDByName(grpName string) (int, error) {
	f, err := os.Open(GroupFilePath)
	if err != nil {
		return -1, err
	}
	defer f.Close()
	br := bufio.NewReader(f)
	for {
		s, err := br.ReadString('\n')
		if err == io.EOF {
			break
		}
		if err != nil {
			return -1, err
		}
		p := strings.Split(s, ":")
		if len(p) >= 3 && p[0] == grpName {
			return strconv.Atoi(p[2])
		}
	}
	return -1, fmt.Errorf("group %q not found", grpName)
}
589641
func getUserUIDGID(_ string) (int, int, error) {
	u, err := user.Lookup(libvirtUser)
	if err != nil {
		return -1, -1, errors.Trace(err)
	}
	uid, err := strconv.ParseUint(u.Uid, 10, 32)
	if err != nil {
		return -1, -1, errors.Trace(err)
	}
	gid, err := strconv.ParseUint(u.Gid, 10, 32)
	if err != nil {
		return -1, -1, errors.Trace(err)
	}
	return int(uid), int(gid), nil
}
751750
func (id ID) String() string {
	text := make([]byte, encodedLen)
	encode(text, id[:])
	return *(*string)(unsafe.Pointer(&text))
}
398826
func shortID() string {
	b := make([]byte, 6)
	io.ReadFull(rand.Reader, b)
	return base64.StdEncoding.EncodeToString(b)
}
533267
func HashIdToString(id byte) (name string, ok bool) {
	for _, m := range hashToHashIdMapping {
		if m.id == id {
			return m.name, true
		}
	}

	return "", false
}
900623
func Id(fingerprint string) string {
	id := md5.New()
	io.WriteString(id, fingerprint)
	h := fmt.Sprintf("%x", id.Sum(nil))
	return strings.ToUpper(h[16:32])
}