GOROOT=$HOME/go
GOOS=linux
GOARCH=amd64
GOBIN=$HOME/bin
export GOROOT GOOS GOARCH GOBIN PATH
When I compile from vi (:make) in terminal, everything is fine. However, when I do the same from gvim (window), I was getting
fatal error: can't find import: fmt
A quick google search pointed me to this
So, gvim is not seeing those environment variables. I confirm in gvim with
:echo $GOROOT
Reports an empty string. So I edit $MYVIMRC (:e $MYVIMRC) and add the following
:let $GOROOT='/home/amitava/go'
:let $GOARCH='amd64'
:let $GOOS='linux'
Worked like a charm!