简体   繁体   中英

go install - do I need to manually update my path?

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM