I'm a bit confused on what the latest best practice is with Go.
Installing the latest (1.17) Go on macos, with no GOPATH env variable, with go mod, I see the following is in my path
/usr/local/go/bin
When I run go install <something>
, then that ends up in ~/go/bin/<something>
. So why is ~/go/bin
not in my path? Do I have to add it manually?
CodePudding user response:
Yes you have to manually add ~/go/bin
to your PATH
.
To do so, add this line in your shell init file (.bashrc
, .zshrc
...):
export PATH=$PATH:$HOME/go/bin