Testing Go,Golang:travis主程序出错,Go get-v
在我的repo的子目录中,我有一些带有Testing Go,Golang:travis主程序出错,Go get-v,testing,go,travis-ci,Testing,Go,Travis Ci,在我的repo的子目录中,我有一些带有package main的脚本来展示我的包的一些示例用法。但在Travis上测试时,这给了我以下错误 repo example-dir sub-dir main.go // this gives me error like the following github.com/~/主程序目录 命令“go get-v./…”失败。重试,第2次,共3次。 我只在Travis中看到这个错误,而在本地机器上没有看到go te
package main
的脚本来展示我的包的一些示例用法。但在Travis上测试时,这给了我以下错误
repo
example-dir
sub-dir
main.go // this gives me error like the following
github.com/~/主程序目录
命令“go get-v./…”失败。重试,第2次,共3次。
我只在Travis中看到这个错误,而在本地机器上没有看到go test
是否仍有办法分离主程序并仍然能够通过Travis测试?在
main.go
中使用正确的路径,这是禁用该文件的正确方法:
// +build local
package main
//other code
然后使用
go-build-tags-local
或go-run-tags-local
在代码中使用的导入路径不正确。