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 想用@vueuse 把项目动态改成深色主题,localStorge里面的vueuse-color-scheme一开始就给我改成了dark,不知道什么原因(相关搜索:背景颜色)
  • ¥20 OPENVPN连接问题
  • ¥15 flask实现搜索框访问数据库
  • ¥15 mrk3399刷完安卓11后投屏调试只能显示一个设备
  • ¥100 如何用js写一个游戏云存档
  • ¥15 ansys fluent计算闪退
  • ¥15 有关wireshark抓包的问题
  • ¥15 需要写计算过程,不要写代码,求解答,数据都在图上
  • ¥15 向数据表用newid方式插入GUID问题
  • ¥15 multisim电路设计