代码之家  ›  专栏  ›  技术社区  ›  Yaron Idan

go build找不到包源

  •  0
  • Yaron Idan  · 技术社区  · 6 年前

    我正在努力建立我在这里发现的“团队城市普罗米修斯”出口商。 repo .
    在自述文件中,它指示我执行以下命令来构建项目- 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)
    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)
    

    我试着四处寻找go包管理器,并使用它们预安装包 dep govendor 但这两个看起来都不适合我的用例)。

    也打开了一个 issue 在Github回购协议中,还有一些其他问题没有得到任何回应,所以我没有得到我的希望。

    我对Go不太熟悉,所以我希望这里的人能知道我遗漏了什么。
    谢谢!

    1 回复  |  直到 6 年前
        1
  •  4
  •   poy    6 年前

    我建议换衣服 go build go get . 这将获取所有依赖项,并将生成二进制文件并将其放入 $GOPATH/bin . 去建 希望一切都已经就绪。

    推荐文章