0

I have an app that requires sudo privilege to run as it connect to a port. I run it from the command prompt with the command. sudo go run appname.go.

How can I run the app using the debugger using visual code with the delve debugger? I can run and trace it fine until it reaches the point where it attempts to open the port and then it exits with the permissions denied error.

  • 2
    Does it need to connect to port below 1024 (for which you need sudo). Maybe you can debug it with higher port and run in "production" on the lower port? – ivanjovanovic Jun 11 '17 at 23:13
  • Thank you so much. That is a great idea. I did not know about the 1024 cutoff. – Justin Madison Jun 11 '17 at 23:43
  • 1
    Ports below 1024 are system related and using them, unless you really want to is not advisable. As it is not advisable to run your application in production as root user, that way you expose yourself to a lot of vulnerabilities that you don't have to. – ivanjovanovic Jun 12 '17 at 12:18
  • You can try to start vscode with sudo – chendesheng Jun 16 '17 at 00:01

0 Answers0