[英]Golang, GOPATH not set error
I am getting the following error when I am trying to run the go code:当我尝试运行 go 代码时出现以下错误:
cannot find package "github.com/drone/routes" in any of:
/usr/local/Cellar/go/1.5.1/libexec/src/github.com/drone/routes (from $GOROOT)
($GOPATH not set)
Any help would be highly appreciated.任何帮助将不胜感激。
Set under the Windows: open cmd Windows下设置:打开cmd
C:\Users\zhg>set GOPATH=C:\PATH
C:\Users\zhg>echo %GOPATH%
>>> C:\PATH
Set under the Linux: open bash Linux下设置:打开bash
zhg@ubuntu:~$ export GOPATH=$HOME/path
zhg@ubuntu:~$ echo $GOPATH
>>> /home/zhg/path
Looking all go environment: $ go env
查看所有 go 环境: $ go env
Set forever, you need to edit the environment files.设置为永久,需要编辑环境文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.