In Go's wiki page on Github, it is told to be set in ~/.bash_profile:
https://github.com/golang/go/wiki/Setting-GOPATH
In this StackOverflow question most of the top voted answers suggested to be set in the ~/.bashrc file:
how do I SET the GOPATH environment variable on Ubuntu? What file must I edit?
I have read that ~/.profile is perhaps the best way to set environment variables. Is there a reason that ~/.profile is not used to set $GOPATH or is it just a matter of preference?