user.Current
u, _ := user.Current()
fmt.Println(u.Username, u.Uid, u.HomeDir)
os/userLook up the current user, users by name/uid, and their groups.
u, _ := user.Current()
fmt.Println(u.Username, u.Uid, u.HomeDir)
os.UserHomeDir is often what you really want — it consults $HOME and falls back correctly.
home, _ := os.UserHomeDir()
fmt.Println(home)
u, _ := user.Lookup("ada")
u, _ = user.LookupId("1000")
gids, _ := u.GroupIds()
for _, gid := range gids {
g, _ := user.LookupGroupId(gid)
fmt.Println(g.Name)
}