设置:
看看我的配置:
$ echo $GOPATH && ls -r $GOPATH
/home/cyrus/.go
src  pkg  bin
$ echo $GOROOT && ls $GOROOT
/usr/local/go
api  AUTHORS  bin  CONTRIBUTORS  doc  favicon.ico  include  lib  LICENSE  misc  PATENTS  pkg  README  robots.txt  src  test  VERSION您可以看到,我为$GOPATH设置了一条路径。此外,我还创建了可能不需要的子目录。
问题:
为什么下面的命令生成此错误消息?
$ go get code.google.com/p/go-tour/gotour                                                                                                               
package code.google.com/p/go-tour/gotour: cannot download, $GOPATH not set. For more details see: go help gopath发布于 2017-01-17 16:28:14
当您运行go env时,您应该能够查看您的GOPATH是否已设置。不过,在我的情况下,当我在终端上运行它时,这个命令就会解决这个问题。
export GOPATH=/usr/local/binhttps://stackoverflow.com/questions/17872223
复制相似问题