package main import ( "os/user" "strconv" ) func usergroupids(username string, groupname string) (int, int, error) { u, err := user.Lookup(username) if err != nil { return -1, -1, err } uid, _ := strconv.Atoi(u.Uid) gid, _ := strconv.Atoi(u.Gid) if conf.group != "" { g, err := user.LookupGroup(groupname) if err != nil { return uid, -1, err } gid, _ = strconv.Atoi(g.Gid) } return uid, gid, nil }