Ok, So I\'ve downloaded Go 1.1 and put it into $HOME/Documents/go.
Then, I\'ve modified my .bashrc
to be:
export GOPATH=$HOME/Documents/go
TLDR: Unset $GOROOT
by running following command in your terminal export GOROOT=""
I had Go installed on Ubuntu 16.04 and everything was working fine.
Then by mistake I set the $GOROOT
to $GOPATH
following a tutorial, at which point my build started to fail saying:
warning: GOPATH set to GOROOT has no effect
cannot find package "fmt" in any of:
... (from $GOROOT) ($GOPATH not set)
cannot find package "io/ioutil" in any of:
imports runtime: cannot find package "runtime" in any of:
/home/mhsn/go/src/runtime (from $GOROOT)
($GOPATH not set)
Every solution I read was suggesting to not set this variable, and I wanted to unset this. I found the following fix to get it unset: export GOROOT=""
in bash.
Having unset the $GOROOT
back to empty which was recommended by everyone so go defaulted back to original path. And it fixed the issue for me and go build started to work again.