最佳答案
我是 Go 的新手,我试图用最少的文档建立一个 Go 项目: https://github.com/alphagov/metadata-api
我已经克隆了它,但是当我尝试 go build
时,我会得到以下警告:
main.go:8:2: cannot find package "github.com/Sirupsen/logrus" in any of:
/usr/local/Cellar/go/1.3.3/libexec/src/pkg/github.com/Sirupsen/logrus (from $GOROOT)
/Users/me/go/src/github.com/Sirupsen/logrus (from $GOPATH)
main.go:14:2: cannot find package "github.com/alphagov/metadata-api/content_api" in any of:
/usr/local/Cellar/go/1.3.3/libexec/src/pkg/github.com/alphagov/metadata-api/content_api (from $GOROOT)
/Users/me/go/src/github.com/alphagov/metadata-api/content_api (from $GOPATH)
我猜这是因为我没有安装相当于需求的 Go?
我的 GOPATH
设置好了:
metadata-api$ echo $GOPATH
/Users/me/go
Go 可执行文件在
metadata-ape$ echo $PATH
....:/Users/me/go/bin
我要怎么做才能帮你找到这些包裹?