About “sudo go run main.go”

后端 未结 2 1734
暗喜
暗喜 2020-12-22 05:50

I use Go in my Ubuntu 16.04, and I set GOPATH, GOROOT and run simple code successfully.

Now I want to capture network packet by \"gopacket\

2条回答
  •  隐瞒了意图╮
    2020-12-22 06:34

    sudo -E go run main.go may work for you.

    Here is what you can get about -E option from man sudo

    -E, --preserve-env
       Indicates to the security policy that the user wishes to preserve
       their existing environment variables. The security policy may return
       an error if the user does not have permission to preserve the environment.
    

提交回复
热议问题