package installer import "os/user" func IsAdmin() { u, err := user.Current() if nil != err { return false } // https://support.microsoft.com/en-us/help/243330/well-known-security-identifiers-in-windows-operating-systems // not quite, but close enough for now // BUILTIN\ADMINISTRATORS if "S-1-5-32-544" == u.Uid || "S-1-5-32-544" == u.Gid { return true } ids := u.GroupIds() for i := range ids { if "S-1-5-32-544" == ids[i] { return true } } return false }