dqdl6469 2018-11-16 18:27
浏览 135
已采纳

去构建找不到包源

I'm trying to build the teamcity prometheus exporter I found in this repo.
In the readme it instructs me to execute the following command which should build the project - 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

But it fails with the following error -

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)
teamcity_exporter.go:19:2: cannot find package "github.com/prometheus/common/version" in any of:
    /go/src/github.com/guidewire/teamcity_exporter/vendor/github.com/prometheus/common/version (vendor tree)
    /usr/local/go/src/github.com/prometheus/common/version (from $GOROOT)
    /go/src/github.com/prometheus/common/version (from $GOPATH)
config.go:8:2: cannot find package "gopkg.in/yaml.v2" in any of:
    /go/src/github.com/guidewire/teamcity_exporter/vendor/gopkg.in/yaml.v2 (vendor tree)
    /usr/local/go/src/gopkg.in/yaml.v2 (from $GOROOT)
    /go/src/gopkg.in/yaml.v2 (from $GOPATH)

I've tried looking around for go package managers and using them to preinstall the packages (went over dep and govendor but both didn't seem fit to my use case) .

Also opened an issue in the github repo but there are a few other issues that didn't get any response so I'm not getting my hopes up.

I'm not that familiar with go, so I was hoping someone here might have a clue as to what I'm missing.
Thanks!

  • 写回答

1条回答 默认 最新

  • doulipi3742 2018-11-16 18:36
    关注

    I would recommend changing go build to go get. That should fetch all the dependencies and will also build the binary and drop it into $GOPATH/bin. go build expects everything to already be in place.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 outlook无法配置成功
  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题