utils/sudo-check.go (view raw)
1 2 3 4 5 6 7 8 9 10 11 12 13 14
package utils import ( "fmt" "os/user" ) func CheckSudoPrivileges() (bool, error) { currentUser, err := user.Current() if err != nil { return false, fmt.Errorf("error getting current user: %w", err) } return currentUser.Uid == "0", nil }