Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I see $GOPATH is no longer strictly needed, which is nice. But what's the deal with $GOROOT? I seem to always need it set but I don't know if that's just my workflow or force of habit.


People should essentially never set GOROOT. It's mostly a holdover. For example, Ian Lance Taylor on the core Go team wrote [0] somewhat recently:

"It's a special purpose hook that is almost never needed".

[0] https://groups.google.com/g/golang-nuts/c/qDhJbkE1QeY/m/JoV2...


It's either habbit or you are doing something out of the ordinary with your Go installation. The standard installation of Go has not required GOROOT for a very long time.


I use Makefiles for my projects, and right at the top I do:

GOBIN := $(shell go env GOBIN)

And then use that var where needed.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: