go-watchdog/cmd/watchdog/installer/whoami.go

16 lines
204 B
Go
Raw Normal View History

2019-06-27 08:54:51 +00:00
// +build !windows
package installer
import "os/user"
func IsAdmin() bool {
u, err := user.Current()
if nil != err {
return false
}
// not quite, but close enough for now
return "0" == u.Uid
}