0

I inherited a build script that builds a docker image and uses hashicorp/levant library to deploy. For a year or so we have been running go get github.com/jrasell/levant to grab the levant library. In past few days, the repo URL was merged under Hashicorp's organization and we've changed our script to pull with go get github.com/hashicorp/levant. But either way, we get this multi assign error. What does this mean, doesn't 'go' just basically pull the git repo?

../go/src/github.com/hashicorp/levant/template/render.go:28:11: cannot assign 
*"github.com/hashicorp/nomad/vendor/github.com/hashicorp/nomad/api".Job to job 
(type *"github.com/hashicorp/nomad/api".Job) in multiple assignment
4

2 回答 2

0

我推荐你使用Go 模块

hashicorp/levant确实有go.{mod,sum}文件,因此您应该忘记使用 go get 方式。

最好做一个克隆并遵循 go module 方式,即,

git clone git@github.com:hashicorp/levant.git
go test ./...
go build ./...

这些步骤不仅可以克隆您的存储库,还可以带来构建/测试包所需的依赖包。

注意:你应该有Go v1.11+

于 2020-08-22T11:36:01.110 回答
0

首先,go get使用包,而不是存储库。

除了拉取它们之外,go get还可以编译和安装它们,这就是您弹出错误的时候。

更多信息在这里:

https://nanxiao.gitbooks.io/golang-101-hacks/content/posts/go-get-command.html

于 2020-08-22T05:45:37.193 回答