- I WAS reading Learning GO and suggest that needs to be declared on PATH
GOPATH="/home/user/go"
- when I run
go env
1.18.1, is already declared, so why still suggesting declaring inside yourpath
in.bashrc
or.bash_profile
thanks
CodePudding user response:
[S]hould I still declare GOPATH, GOROOT?
No and NO!
GOPATH defaults to $HOME/go which is fine and GOPATH based builds are deprecated since several years. Use modules.
GOROOT never was a thing for the enduser of Go. You have to set if you work on the Go compiler itself or install Go in unusual location (which no enduser should do).
Keep away from any resource wich promotes GOPATH or even advises to mess with GOROOT.