【问题标题】:Error using Godep on Travis CI automated build for tip version of Go在 Travis CI 自动构建 Go 的尖端版本时使用 Godep 时出错
【发布时间】:2023-03-10 21:14:01
【问题描述】:

我正在使用 Travis CI 来自动化我的 Go 项目的构建和测试。

./Godeps/Godeps.json 看起来像这样:

{
    "ImportPath": "github.com/my_project_path",
    "GoVersion": "go1.5",
    "Packages": [
        "./..."
    ],
    "Deps": [
        {
            "ImportPath": "github.com/Sirupsen/logrus",
            "Comment": "v0.8.7-53-g446d1c1",
            "Rev": "446d1c146faa8ed3f4218f056fcd165f6bcfda81"
        }
    ]
}

.travis.yml 文件如下所示:

language: go

go: 
 - 1.3.3
 - 1.4.2
 - 1.5.1
 - release
 - tip

before_install:
 - go get github.com/my_project_path
 - go get github.com/tools/godep

install:
 - godep restore

script:
 - go test -v ./...

由于go version,除tip 之外的所有其他构建都有效。

tip 的 Travis CI 日志的最后几行是:

$ go version

go version devel +e4dcf5c Thu Dec 24 06:55:33 2015 +0000 linux/amd64
go.env

$ go env

GOARCH="amd64"

GOBIN=""

GOEXE=""

GOHOSTARCH="amd64"

GOHOSTOS="linux"

GOOS="linux"

GOPATH="/home/travis/gopath"

GORACE=""

GOROOT="/home/travis/.gimme/versions/go"

GOTOOLDIR="/home/travis/.gimme/versions/go/pkg/tool/linux_amd64"

GO15VENDOREXPERIMENT="1"

CC="gcc"

GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0"

CXX="g++"

CGO_ENABLED="1"
before_install.1

3.52s$ go get github.com/my_project_path
before_install.2

3.34s$ go get github.com/tools/godep

0.02s$ godep restore

godep: Error determing major go version from: "devel"

The command "godep restore" failed and exited with 1 during .

Your build has been stopped.

我该如何解决这个问题?我只是坚持使用go get ./...吗?

编辑:似乎有人发了pull request 来解决这个问题。

EDIT2: 似乎是拉取请求was merged。将测试它是否很快修复。

【问题讨论】:

  • 我仍然遇到这个问题。 Travis 在运行 godep restore 之前执行了 go get github.com/tools/godep,但它失败并显示“godep:将 go1.4 与 devel 进行比较时出错”

标签: go travis-ci godeps


【解决方案1】:

所以我在 2015 年 12 月 24 日问了这个问题。

2015 年 12 月 29 日,github 用户 zchee 打开了 pull request,解决了我的问题中提到的问题。

2016 年 1 月 4 日,拉取请求被合并到 godepmaster 分支中。所以基本上这个问题现在已经解决,为了让Travis CI 使用godep restore 并针对Gotip 版本测试你的项目,你的.travis.yml 文件应该看起来像它在问题中的样子,即:

language: go

go: 
 - 1.3.3
 - 1.4.2
 - 1.5.1
 - release
 - tip

before_install:
 - go get github.com/my_project_path
 - go get github.com/tools/godep

install:
 - godep restore

script:
 - go test -v ./...

【讨论】:

    猜你喜欢
    • 2017-06-11
    • 1970-01-01
    • 2016-10-07
    • 2020-07-17
    • 2016-05-03
    • 2021-11-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多