我正在尝试构建我在此repo中找到的 teamcity prometheus exporter 。在自述文件中,它指示我执行以下应该构建项目的命令 - docker run --rm -v "$PWD":/go/src/github.com/guidewire/teamcity_exporter -w /go/src/github.com/guidewire/teamcity_exporter -e GOOS=linux -e GOARCH=amd64 golang:1.8 go build -o bin/teamcity_exporter -v但它失败并出现以下错误 -teamcity_exporter.go:15:2: cannot find package "github.com/guidewire/teamcity-go-bindings" in any of: /go/src/github.com/guidewire/teamcity_exporter/vendor/github.com/guidewire/teamcity-go-bindings (vendor tree) /usr/local/go/src/github.com/guidewire/teamcity-go-bindings (from $GOROOT) /go/src/github.com/guidewire/teamcity-go-bindings (from $GOPATH)teamcity_exporter.go:16:2: cannot find package "github.com/orcaman/concurrent-map" in any of: /go/src/github.com/guidewire/teamcity_exporter/vendor/github.com/orcaman/concurrent-map (vendor tree) /usr/local/go/src/github.com/orcaman/concurrent-map (from $GOROOT) /go/src/github.com/orcaman/concurrent-map (from $GOPATH)collector.go:6:2: cannot find package "github.com/prometheus/client_golang/prometheus" in any of: /go/src/github.com/guidewire/teamcity_exporter/vendor/github.com/prometheus/client_golang/prometheus (vendor tree) /usr/local/go/src/github.com/prometheus/client_golang/prometheus (from $GOROOT) /go/src/github.com/prometheus/client_golang/prometheus (from $GOPATH)teamcity_exporter.go:18:2: cannot find package "github.com/prometheus/common/log" in any of: /go/src/github.com/guidewire/teamcity_exporter/vendor/github.com/prometheus/common/log (vendor tree) /usr/local/go/src/github.com/prometheus/common/log (from $GOROOT) /go/src/github.com/prometheus/common/log (from $GOPATH)我尝试四处寻找 go 包管理器并使用它们来预安装包(遍历dep和govendor但两者似乎都不适合我的用例)。还在 github 存储库中打开了一个问题,但还有一些其他问题没有得到任何回应,所以我没有抱太大希望。我对 go 不太熟悉,所以我希望这里的人可能知道我缺少什么。谢谢!
1 回答
12345678_0001
TA贡献1802条经验 获得超5个赞
我建议go build
改为go get
. 这应该获取所有依赖项,还将构建二进制文件并将其放入$GOPATH/bin
. go build
期望一切都已经到位。
- 1 回答
- 0 关注
- 166 浏览
添加回答
举报
0/150
提交
取消