I'm trying to run a Go program with admin rights in Windows. Like sudo in Linux. To do that I'm launching cmd as Administrator. I also tried runas administrator command.
The problem is os.Getuid()
function returns -1. The program checks it and if it is not 0 it tells, you don't have the admin rights.
Code snippet from the Go program Gor (listener.go):
if os.Getuid() != 0 {
fmt.Println("Please start the listener as root or sudo!")
fmt.Println("This is required since listener sniff traffic on given port.")
os.Exit(1)
}
Is there any solution for this issue?
Thanks