In case you came here looking for how to resolve this error for VSCode - it took me a little bit to find the setting.
File -> Preferences -> Settings
In the settings pane...
User Settings -> Extensions -> Go configuration
Scroll about 2/3rds of the way down until you get to
Install Dependencies When Building. Uncheck that one and restart VSCode.
So far has been working for me (running Ubuntu 18)