我的结构项目
currency-quote-api -
|
|- scraping/ file.go
|- api/ file.go
|- tests/ test.go
|- main.go
当我在travis CI中运行测试时,我收到以下错误
tests/scraping_test.go:4:2: cannot find package "currency-quote-api/scraping" in any of:
/home/travis/.gimme/versions/go1.10.2.linux.amd64/src/currency-quote-api/scraping (from $GOROOT)
/home/travis/gopath/src/github.com/matheussilva97/currency-quote-api/Godeps/_workspace/src/currency-quote-api/scraping (from $GOPATH)
/home/travis/gopath/src/currency-quote-api/scraping
我做错了什么?
我的.travis.yml
sudo: false
language: go
go:
- 1.10.2
notifications:
email: false
before_script:
- go get github.com/gorilla/mux
- go get github.com/PuerkitoBio/goquery
script:
- go test -v ./tests/
答案 0 :(得分:0)
为什么不隐式获得所有软件包:
before_script:
- go get -t -v ./...
对于测试,由于每个测试可以具有自己的依赖性(取决于您将测试放入哪个程序包),因此您应该具有如下脚本:
for d in $(go list ./... | grep -v vendor); do
go test -race -coverprofile=profile.out -covermode=atomic $d
done