英文:
go: cannot find GOROOT directory: /usr/bin/go
问题
我尝试安装一个包,但是即使我的ROOT目录设置正确,仍然遇到以下问题。
p@p-ubuntu:~/ba/docker-lvm-plugin$ which go
/usr/bin/go
p@p-ubuntu:~/ba/docker-lvm-plugin$ echo $GOROOT
/usr/bin/go
p@p-ubuntu:~/ba/docker-lvm-plugin$ go get github.com/Sirupsen/logrus
go: 无法找到GOROOT目录:/usr/bin/go
英文:
Im trying to install a package but get the below problem even though my ROOT directory is set properly.
p@p-ubuntu:~/ba/docker-lvm-plugin$ which go
/usr/bin/go
p@p-ubuntu:~/ba/docker-lvm-plugin$ echo $GOROOT
/usr/bin/go
p@p-ubuntu:~/ba/docker-lvm-plugin$ go get github.com/Sirupsen/logrus
go: cannot find GOROOT directory: /usr/bin/go
答案1
得分: 3
如果执行go env
命令,可能会返回以下内容:
set GOPATH=C:\Users\user\go
set GOROOT=C:\tools\go
GOPATH
是什么?
> 创建您的工作区目录,%USERPROFILE%\go
。(如果您想使用其他目录,您需要设置GOPATH
环境变量;有关详细信息,请参阅《如何编写Go代码》。)
GOROOT
是什么?
> 如果您选择的目录不是c:\Go,则必须将GOROOT环境变量设置为您选择的路径。
英文:
If one issues go env
then the following could be returned:
set GOPATH=C:\Users\user\go
set GOROOT=C:\tools\go
What is the GOPATH
?
> Create your workspace directory, %USERPROFILE%\go
. (If you'd like to
> use a different directory, you will need to set the GOPATH
environment
> variable; see How to Write Go Code for details.)
What is the GOROOT
?
> If you chose a directory other than c:\Go, you must set the GOROOT
> environment variable to your chosen path.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论