Reputation: 1337
I'm developing Golang project and using TravisCI. As dependency tool, Godeps is used.
After running test by git push, something error was happened as below.
# command-line-arguments
cmd/proj/main_test.go:6:2: cannot find package
"command-line-/vendor/github.com/xxxxx/xxxxx/abc" in any of:
/home/travis/.gimme/versions/go1.6.linux.amd64/src/command-line-/vendor/github.com/xxxxx/xxxxx/xxx
Why it can't find package? As build log, it seems to work well by go get command.
My travis.yml is here.
language: go
sudo: false
go:
- 1.6
- tip
services:
- redis-server
env:
global:
- secure: "xxxxx"
script:
- go fmt ./...
- go vet $(go list ./... | grep -v /vendor/)
- go test -v cmd/xxxx/*.go -xxxx ${XXXXX}
before_install:
- go get github.com/tools/godep
branches:
only:
- master
tip of go version is OK. But 1.6 or 1.5 version can't run well.
How can I manage that situation?
Upvotes: 0
Views: 964
Reputation: 176352
The way Go 1.6 manages dependencies is different than Go 1.5 and previous versions.
1.6 introduces the /vendor
folder. Whenever you import a dependency, if the library exists in /vendor
, then the library is loaded.
The behavior was introduced in 1.5, but in that version it was experimental. It means that you need to enable it using the GO15VENDOREXPERIMENT=1
environment variable.
If you only need to provide support for 1.5 and 1.6, then simply add the variable to Travis when building 1.5 projects.
If you need to extend support also for versions before 1.5, then it's a little bit more complicated.
Upvotes: 1