// Copyright 2024 Matthew Rich . All rights reserved. // package resource import ( "os/user" "strconv" ) func LookupUIDString(userName string) string { user, userLookupErr := user.Lookup(userName) if userLookupErr != nil { return "" } return user.Uid } func LookupUID(userName string) (int,error) { user, userLookupErr := user.Lookup(userName) if userLookupErr != nil { return -1,userLookupErr } uid, uidErr := strconv.Atoi(user.Uid) if uidErr != nil { return -1,uidErr } return uid,nil } func LookupGID(groupName string) (int,error) { group, groupLookupErr := user.LookupGroup(groupName) if groupLookupErr != nil { return -1,groupLookupErr } gid, gidErr := strconv.Atoi(group.Gid) if gidErr != nil { return -1,gidErr } return gid, nil }