如何在travis-ci |上使用远程软件包走 [英] how to use remote packages on travis-ci | GO

查看:88
本文介绍了如何在travis-ci |上使用远程软件包走的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我运行一个go脚本时(运行example.go)我得到这个错误

  / 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)


$ b example.go使用 p>

  importgithub.com/user/examplepackage


$ b

travis.yml 文件如下所示:

 安装:
- 去得到...

before_script:
- 去运行example.go

travis-ci团队不知道安装和配置GOPATH和GOROOT?

解决你应该在你的.travis.yml文件中添加 language:go ,这样Travis CI就知道这个项目是一个Go项目并且设置了GOPATH和GOROOT正确。 默认情况下,Travis CI运行 go get -d -v。/ ...&&在安装步骤中去build -v ./...,所以我认为你可以将你的.travis.yml改为这个:

 语言:go 
before_script:
- 运行example.go
code>

如果运行example.go 是您的测试脚本,您应该更改为:

 语言:go 
脚本:
- 运行example.go

Travis CI的更多Go文档 here


when I run a 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 travis.yml file looks like :

install:
- go get ... 

before_script:
- go run example.go

travis-ci team doesn't know to install and configure GOPATH and GOROOT ?

解决方案

You should add language: go to your .travis.yml file, that way Travis CI knows that the project is a Go project and sets up the GOPATH and GOROOT correctly. By default, Travis CI runs go get -d -v ./... && go build -v ./... in the install step, so I think you may be able to change your .travis.yml to this:

language: go
before_script:
  - go run example.go

If the go run example.go is your test script, you should change it to this:

language: go
script:
  - go run example.go

There's more Go docs for Travis CI here.

这篇关于如何在travis-ci |上使用远程软件包走的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆