Reputation: 669
My demo golang project is https://github.com/aQuaYi/demoGolangProjectWithCI
demoGolangProjectWithCI/subModel/subModelAdd.go is
package subModel
import (
"demoGolangProjectWithCI"
)
//Add returns sum of a and b
func Add(a, b int) int {
return demoGolangProjectWithCI.Add(a, b)
}
and my .travis.yml is
language: go
go:
- 1.8.3
script: go test ./...
but travis said me "package demoGolangProjectWithCI: unrecognized import path "demoGolangProjectWithCI" (import path does not begin with hostname)"
detail is https://travis-ci.org/aQuaYi/demoGolangProjectWithCI/builds/247416861
How Could I fix this?
Thank you very much.
Upvotes: 1
Views: 8014
Reputation: 7723
demoGolangProjectWithCI
is not resolved from subModel
because import "demoGolangProjectWithCI"
mean absolute path. You can write relative path like ./demoGolangProjectWithCI
. But, in generally, you've better to write full-github-paths as github.com/aQuaYi/demoGolangProject
since your package may be used by other one's project.
Upvotes: 2