为什么还是显示没有设置GOPATH,尽管我已经设置了?

huangapple go评论93阅读模式
英文:

Why still says no GOPATH though i've set it?

问题

以下是翻译好的内容:

无论是GoSublime还是vim-go都告诉我GOPATH没有设置,但是我已经设置了。

我的~/.bashrc文件内容如下:

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

我可以使用go get命令将gocode安装到~/gopath/bin目录下,
但是它输出了以下内容:...:/home/myusrname/gopath/bin: No such file or directory
对于~$ $PATH命令。

英文:

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

答案1

得分: 1

$PATH 是尝试执行你的 $PATH 字符串,也就是将 $PATH 变量的内容写入控制台并按下回车键。这导致了你看到的错误。

你想要的是:

~$ echo $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

答案2

得分: 0

终于搞定了:我必须通过设置$GOPATH在shell中打开gvim!

英文:

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

答案3

得分: 0

你可以尝试使用以下命令启动 gvim:

bash -lc gvim

这将使用你的 .bashrc 文件中的设置启动 gvim。

这个信息来自于 https://github.com/fatih/vim-go/issues/468

英文:

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

答案4

得分: 0

在我的情况下,我在我的.profile文件中添加了GOPATH。

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

然后重新启动我的Ubuntu 16.04。

接下来,为了安装vim-go插件,我在gvim中使用以下命令:

:GoInstallBinaries
英文:

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

huangapple
  • 本文由 发表于 2015年10月1日 00:48:02
  • 转载请务必保留本文链接:https://go.coder-hub.com/32871590.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定