gpt4 book ai didi

go: 找不到 GOROOT 目录:/usr/bin/go

转载 作者:数据小太阳 更新时间:2023-10-29 03:43:55 25 4
gpt4 key购买 nike

我试图安装一个包,但即使我的 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: cannot find GOROOT directory: /usr/bin/go

最佳答案

如果发出 go env 则可能会返回以下内容:

set GOPATH=C:\Users\user\go
set GOROOT=C:\tools\go

什么是 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.)

什么是 GOROOT

If you chose a directory other than c:\Go, you must set the GOROOT environment variable to your chosen path.

关于go: 找不到 GOROOT 目录:/usr/bin/go,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44954007/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com