为什么我设置了GOPATH却仍然不说?

Both GoSublime and vim-go tells me that GOPATH isn't set, however I've already done this.

my ~/.bashrc:

export GOPATH=$HOME/gopath
export PATH="$PATH:$GOPATH/bin"

and I can use go get to install gocode to my ~/gopath/bin but it prints that: ...:/home/myusrname/gopath/bin: No such file or directory for ~$ $PATH

~$ $PATH

is trying to execute your $PATH string, i.e. it's equivalent to writing the contents of the $PATH variable into the console and pressing enter. That results in the error you're seeing.

What you want is

~$ echo $PATH

finally i got it: i have to open gvim through shell with $GOPATH set - -!

You can try to start gvim with the command: bash -lc gvim

It then starts gvim with the settings in your .bashrc file.

This is from https://github.com/fatih/vim-go/issues/468

In my case, I added GOPATH in my .profile

export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin

And restart my Unbuntu 16.04

Then for my vim-go, I installed the vim-go by the following command in gvim

:GoInstallBinaries