I need to get all the SIDs of the groups of a current user.
I noticed the os/user
package may do this, but I cannot access the functions in lookup_windows.go
, because the functions are not capitalized, right?
How can I get all the SIDs of the groups of the current user?
Try something like this:
user, err := user.Current()
if err != nil {
panic(err)
}
groupIds, err := user.GroupIds()
if err != nil {
panic(err)
}
fmt.Printf("Groups: %v
", groupIds)
How can I use this package in my project, e.g. the listGoups
Not at all.
You simply cannot. You have to use a different package, e.g. your own fork.