I fixed it. The issue was a lack of knowledge of
bash config files. I found the details on the SublimeLinter page for troubleshooting custom linters.
Turning on Debug, I saw that the expanded PATH that the SublimeLinter was using did not include any of my custom PATH settings.
- move all of your
GOvariables to a
- move all of your
PATHvariables to that same
- add a line to your
.bashrcfile to execute the
.bash_profilefile for interactive terminals
(Longer answer below, for Linux users)
When starting a terminal, this is an "interactive" bash shell. bash reads the
.bashrc file only, which I had setup correctly. I did not have a
.bash_profile as my
.bashrc worked fine for interactive shells with all of my settings.
But from within SublimeLinter, this loads a "login" bash shell - that is not interactive. On Linux, this only loads the
.bash_profile file - not the
Add this to the top of your
Move your GO variables and PATH changes (and FYI, ALL OTHER path entries you've modified in this .bashrc file) to a new
.bash_profilefile. Make sure to remove them from .bashrc.
Done. Close Sublime and reopen. The path is now picked up properly.
This works because the
source ~/.bash_profile file is read on every interactive terminal you open, cause the .bashrc file is used there. But for login only sessions, such as the one from SublimeLinter, only the
.bash_profile is used - your .bashrc is not executed.
So, you want to specify your custom GO variables (GOROOT, GOPATH, etc) in your
.bash_profile only, not in the .bashrc. But, in order to read this .bash_profile file from interactive shells (e.g. terminals), you have to execute that .bash_profile. We do this with the first line to add at the top of your .bashrc file:
source ~/.bash_profile. This runs the profile script that sucks in your custom GO variables, as well as all of your custom PATH variables.
(for OSX) See the first link above in this comment.
You can read more about bash files here: http://www.joshstaiger.org/archives/2005/07/bash_profile_vs.html