Go,Golang:主程序的travis错误,去获取-v

时间:2014-07-28 06:28:14

标签: testing go travis-ci

在我的repo的子目录中,我有一些package main的脚本来显示我的包的一些示例用法。但是在Travis上进行测试时,这会给我带来以下错误。

 repo

 example-dir
      sub-dir
          main.go  // this gives me error like the following

github.com/~/directory-for-main-program The command "go get -v ./..." failed. Retrying, 2 of 3.

我只在Travis中看到此错误,而不是在go test的本地计算机中。

是否有分离主程序并且仍能通过Travis测试?

1 个答案:

答案 0 :(得分:1)

使用main.go中的正确路径,这是正确的方法,或使用build constraints来禁用该文件:

// +build local

package main

//other code

然后使用go build -tags localgo run -tags local

在本地构建它