我在 Fedora 21 筆記本電腦上安裝了 GO 并設(shè)置了 GOPATH 和 GOBIN,但由于某種原因它不允許我安裝我的 go 程序。pred@computer01 [20:03:02] ~ $ echo $GOPATH/home/pred/Documents/GOpred@computer01 [20:03:11] ~ $ echo $GOBIN/home/pred/Documents/GO/binpred@computer01 [20:03:15] ~ $ cd $GOPATHpred@computer01 [20:03:21] ~/Documents/GO $ go install src/github.com/pred3/go_helloworld/helloworld/helloworld.go go install: no install location for .go files listed on command line (GOBIN not set)pred@computer01 [20:03:32] ~/Documents/GO $ go envGOARCH="amd64"GOBIN="/home/pred/Documents/GO/bin"GOCHAR="6"GOEXE=""GOHOSTARCH="amd64"GOHOSTOS="linux"GOOS="linux"GOPATH="/home/pred/Documents/GO"GORACE=""GOROOT="/usr/lib/golang"GOTOOLDIR="/usr/lib/golang/pkg/tool/linux_amd64"CC="gcc"GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0"CXX="g++"CGO_ENABLED="1"我還應(yīng)該做什么才能讓它發(fā)揮作用?- 編輯 -發(fā)出如下所述的以下命令也會(huì)出錯(cuò)。pred@computer1 [21:22:51] ~/Documents/GO $ go install src/github.com/pred3/go_helloworld/helloworldcan't load package: package src/github.com/predatorian3/go_helloworld/helloworld: cannot find package "src/github.com/pred3/go_helloworld/helloworld" in any of: /usr/lib/golang/src/src/github.com/pred3/go_helloworld/helloworld (from $GOROOT) /home/pred/Documents/GO/src/src/github.com/pred3/go_helloworld/helloworld (from $GOPATH)但是,我package main在嘗試安裝的 go 文件的開頭沒有。一旦我將其更改為package main有效。我不知道為什么我不能使用不同的包名。
- 1 回答
- 0 關(guān)注
- 384 瀏覽
添加回答
舉報(bào)
0/150
提交
取消