douyi9447 2018-02-19 08:53
浏览 11

无法通过`go get`检索到的测试依赖项

I'm using Golang (1.9 at this time), and using GitLab CI to test and build binaries and Docker containers.

For some projects, I run into this issue (GitLab CI output):

$ go get
$ go get -u github.com/golang/lint/golint
$ go tool vet -composites=false -shadow=true *.go
$ golint ./...
$ go test --race $(go list ./... | grep -v /vendor/)
# gitlab.my.site/core/proj/mypkg mypkg/mypkg_test.go:18:2: cannot find package 
"gitlab.my.site/core/otherproj/otherpkg" in any of:
/usr/local/go/src/gitlab.my.site/core/otherproj/otherpkg (from $GOROOT)
    /go/src/gitlab.my.site/core/otherproj/otherpkg (from $GOPATH)
FAIL    gitlab.my.site/core/proj/mypkg [setup failed]

The core/otherproj project is private, but clonable through SSH, which is my current workaround.

My main problem is that private projects in dependencies most often work, but sometimes, go getting them consistently fails.

Worth noting is that the otherproj/otherpkg is only a dependency in the test for proj/mypkg; not its primary functionality.

My question is; why does this specific dependency not download from go get, and how do I make it download?

Thanks.

  • 写回答

1条回答 默认 最新

  • duanrenzou1619 2018-02-19 08:58
    关注

    From the docs (also available via go get --help):

    The -t flag instructs get to also download the packages required to build the tests for the specified packages.

    So you need to run go get -t to download test dependencies.

    评论

报告相同问题?

悬赏问题

  • ¥15 我的数据无法存进链表里
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大
  • ¥15 Oracle中如何从clob类型截取特定字符串后面的字符
  • ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
  • ¥15 如何在炒股软件中,爬到我想看的日k线
  • ¥15 seatunnel 怎么配置Elasticsearch
  • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
  • ¥15 (标签-MATLAB|关键词-多址)
  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端