简体   繁体   中英

Golang, GOPATH not set error

I am getting the following error when I am trying to run the go code:

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.

Well it is saying that your GOPATH is not set. I would suggest taking a look at the Go docs to get that configured.

Set under the Windows: open cmd

C:\Users\zhg>set GOPATH=C:\PATH

C:\Users\zhg>echo %GOPATH%
>>> C:\PATH

Set under the Linux: open bash

zhg@ubuntu:~$ export GOPATH=$HOME/path
zhg@ubuntu:~$ echo $GOPATH 
>>> /home/zhg/path

Looking all go environment: $ go env

Set forever, you need to edit the environment files.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM