无法在travis-ci上找到该包-golang。

huangapple go评论135阅读模式
英文:

cannot find package on travis-ci -golang

问题

我正在尝试在构建过程中运行一个Go脚本。该脚本导入了一个名为'custom'的包,但是我遇到了导入错误。

仓库名称是bis。我运行的脚本是configbis.go。导入configbis.go的包是mymodule

项目结构如下:

bisrepo -------
 |            |
mymodule    configbis.go

运行命令go run configbis.go时,出现以下错误:

configbis.go:16:2: 找不到包"bisrepo/mymodule",可能的位置有:

/home/travis/.gvm/gos/go1.1.2/src/pkg/bisrepo/mymodule(来自$GOROOT)

/home/travis/.gvm/pkgsets/go1.1.2/global/src/bisrepo/mymodule(来自$GOPATH)

我尝试在configbis.go中导入mymodule,尝试了以下几种方式:

import "mymodule"
import "bisrepo/mymodule"
import "github.com/user/bisrepo/mymodule"

但是都没有成功。我已经没有更多的想法/选项了...
我阅读了travis-ci的文档,但发现它没有用。

英文:

I'm trying to run a go script as part of the build process. The script imports a 'custom' package. However I get this import error.
The repository name is bis. The script which I run is configbis.go. The package imported configbis.go is mymodule

The project structure is as following:

bisrepo -------
 |            |
mymodule    configbis.go

go run configbis.go

configbis.go:16:2: cannot find package "bisrepo/mymodule" in any of:

/home/travis/.gvm/gos/go1.1.2/src/pkg/bisrepo/mymodule (from $GOROOT)

/home/travis/.gvm/pkgsets/go1.1.2/global/src/bisrepo/mymodule (from $GOPATH)

I've tried to import mymodule in configbis.go as following:

import "mymodule"
import "bisrepo/mymodule"
import "github.com/user/bisrepo/mymodule"

None of them works. I run out of ideas/options ...
I read the the travis-ci documentation and I found it useless.

答案1

得分: 2

你可以尝试在你的.travis.yml文件中添加以下内容:

install:
    - go get github.com/user/bisrepo/mymodule
英文:

You could try to add something like that in your .travis.yml:

install:
    - go get github.com/user/bisrepo/mymodule

答案2

得分: 0

为了使用私有仓库,您必须提供一个 GitHub API 授权令牌(类似于在 Heroku 上部署引用私有仓库的 Go 项目时所需的操作)。您可以尝试在您的 .travis.yml 文件中添加以下内容:

before_install:
- echo "machine github.com login $GITHUB_AUTH_TOKEN" > ~/.netrc

这样做可以将您的 GitHub 授权令牌添加到 Travis CI 的配置中。

英文:

in order to use private repos you must provide a github api auth token (similarly so when deploying go projects which reference private repos on Heroku). You can try adding something like this in your .travis.yml

before_install:
- echo "machine github.com login $GITHUB_AUTH_TOKEN" > ~/.netrc

huangapple
  • 本文由 发表于 2014年3月16日 10:14:31
  • 转载请务必保留本文链接:https://go.coder-hub.com/22432202.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定