There is an absolute import and Travis CI

I have a public golang project created at http://github.com/NeilGarb/budget , with the kernel subpackages and api. I save the project to $ GOPATH / src / github.com / NeilGarb / budget.

I would like to run basic ginkgo tests using Travis CI, but I use absolute imports in my test packages, and Travis complains that he cannot find the specified packages.

For example, my test includes:

package user_test

import (
    . "github.com/NeilGarb/budget/core"
)

Running ant works fine on my local machine, but when travis tries to run the test, I get:

core-test:
[exec] Failed to compile core:
[exec] 
[exec] can't load package: package github.com/NeilGarb/budget/core: cannot find package "github.com/NeilGarb/budget/core" in any of:
[exec]  /home/travis/.gvm/gos/go1.2/src/pkg/github.com/NeilGarb/budget/core (from $GOROOT)
[exec]  /home/travis/.gvm/pkgsets/go1.2/global/src/github.com/NeilGarb/budget/core (from $GOPATH)
[exec] 
[exec] Ginkgo ran in 714.967041ms
[exec] Test Suite Failed

I try to use relative imports in my tests (ie "../core"), which works, but then my coverage always shows 0% covered.

What to do?: (

+4
2

, $GOPATH/src/github.com/NeilGarb/budget $TRAVIS_BUILD_DIR.

+1

github.com/NeilGarb/budget/core , . . https://golang.org/cmd/go/#hdr-Vendor_Directories .

0

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


All Articles