when I run a go script ( go run example.go ) I get this error
/home/travis/.gvm/gos/go1.1.2/src/pkg/github.com/user/examplepackage (from $GOROOT)
/home/travis/.gvm/pkgsets/go1.1.2/global/src/github.com/user/examplepackage (from $GOPATH)
example.go imports a package using
import "github.com/user/examplepackage"
The travis.yml
file looks like :
install:
- go get ...
before_script:
- go run example.go
travis-ci team doesn't know to install and configure GOPATH and GOROOT ?
You should add language: go
to your .travis.yml file, that way Travis CI knows that the project is a Go project and sets up the GOPATH and GOROOT correctly. By default, Travis CI runs go get -d -v ./... && go build -v ./...
in the install
step, so I think you may be able to change your .travis.yml to this:
language: go
before_script:
- go run example.go
If the go run example.go
is your test script, you should change it to this:
language: go
script:
- go run example.go
There's more Go docs for Travis CI here.