windowsgoadmin-rights

Run unit test with admin rights


I have a Go unit test. My code launches some external executables requiring admin rights for some of their features.

What's the easiest way to run my unit test with admin privileges? I have studied this post but I don't know how to do it for a unit test.


Solution

  • I'm running the Go unit test again with the updated Go version 1.21.1 and see that the unit test is running just fine. I don't know why it's fixed now. Maybe the newest Go version runs the unit test with admin rights by default. Or else?