我有
导出 GOPATH=$HOME/Documents/go
在我的 .zshrc 中。
尝试使用以下内容构建项目时:
sudo go build -o /usr/bin/
我得到一个
main.go:5:2: cannot find package "github.com/foo/bar" in any of: /usr/local/go/src/github.com/foo/bar (from $GOROOT) /Users/JoahJoah/go/src/github.com/foo/bar (from $GOPATH)
我假设“(from $GOPATH)”表示路径是我将 $GOPATH 变量设置为的路径。和
去环境
输出如下:
GOPATH="/Users/Johannes/Documents/go"
使用 go build 时,路径的“文档”部分似乎被省略了。
是否使用其他地方的 GOPATH 构建?
眼眸繁星
相关分类