How to use remote packages on travis-ci | GO

when I run 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 file travis.ymllooks like this:

install:
- go get ... 

before_script:
- go run example.go

The travis-ci team does not know how to install and configure GOPATH and GOROOT?

0
source share
1 answer

You must add a language: gofile to your .travis.yml, so Travis CI knows that the project is a Go project and correctly sets GOPATH and GOROOT. By default , Travis CI launches go get -d -v ./... && go build -v ./...in step install, so I think you can change your .travis.yml to this:

language: go
before_script:
  - go run example.go

go run example.go script, :

language: go
script:
  - go run example.go

Go docs Travis CI .

+1

Source: https://habr.com/ru/post/1532839/


All Articles