GoLang:在执行go install时遇到以下错误

huangapple go评论104阅读模式
英文:

GoLang: getting this error upon go install

问题

当我输入'go install'时,我收到了以下错误信息:

root@kali:~/Scripts/Enum/gobuster# go install

go install: GOPATH之外的目录/root/Scripts/Enum/gobuster没有安装位置
更多详情请参阅:go help gopath

我的'go env'如下所示:

root@kali:~/Scripts/Enum/gobuster# go env

GOARCH="386"
GOBIN=""
GOEXE=""
GOHOSTARCH="386"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/root"
GORACE=""
GOROOT="/usr/lib/go"
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_386"
GO15VENDOREXPERIMENT="1"
CC="gcc"
GOGCCFLAGS="-fPIC -m32 -pthread -fmessage-length=0"
CXX="g++"
CGO_ENABLED="1"

有人可以帮忙吗?
谢谢。

英文:

I am getting this error message when typing 'go install'.

root@kali:~/Scripts/Enum/gobuster# go install

go install: no install location for directory /root/Scripts/Enum/gobuster outside GOPATH
For more details see: go help gopath

My 'go env' is as following.

root@kali:~/Scripts/Enum/gobuster# go env

GOARCH="386"
GOBIN=""
GOEXE=""
GOHOSTARCH="386"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/root"
GORACE=""
GOROOT="/usr/lib/go"
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_386"
GO15VENDOREXPERIMENT="1"
CC="gcc"
GOGCCFLAGS="-fPIC -m32 -pthread -fmessage-length=0"
CXX="g++"
CGO_ENABLED="1"

Can someone help please?
Thank you.

答案1

得分: 1

@Young Jang,
你需要将你的代码放在一个非常特定的位置,即Go的工作区下,同时还要按照一定的位置格式来匹配你的代码库,例如:
~/go/src/github.com/young_jang/gobuster

更多详情请参考:https://www.goinggo.net/2016/05/installing-go-and-your-workspace.html

英文:

@Young Jang,
You need to keep your code in a very specific location, i.e. under the Go's workspace, but also, following a location format to match your repository,
for example:
~/go/src/github.com/young_jang/gobuster

More details: https://www.goinggo.net/2016/05/installing-go-and-your-workspace.html

huangapple
  • 本文由 发表于 2016年12月1日 05:32:18
  • 转载请务必保留本文链接:https://go.coder-hub.com/40898613.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定