无法在Travis中构建Go项目。

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

Can't build go project in travis

问题

我开始创建一个非常轻量级的消息代理,以练习使用Go语言、Travis和一些AWS服务,全部放在一个项目中。

我目前的问题是,我可以在本地机器上构建、运行和测试我的开发分支,但是当Travis尝试构建时,我遇到了一个编译错误。它不喜欢的代码直接来自AWS的示例,这让我更加困惑。

Travis构建失败
https://travis-ci.org/hevnly/eevy/builds/65687886

Github仓库 https://github.com/hevnly/eevy/tree/92412cf729ed546d698ded1e514d2d54c340ff81

错误信息
<pre>
handler/lambda.go:31: 无法将 "github.com/awslabs/aws-sdk-go/aws".Config 字面量(类型为 *"github.com/awslabs/aws-sdk-go/aws".Config)作为 lambda.New 的参数中的类型 *"github.com/aws/aws-sdk-go/aws".Config
handler/sqs.go:26: 无法将 "github.com/awslabs/aws-sdk-go/aws".Config 字面量(类型为 *"github.com/awslabs/aws-sdk-go/aws".Config)作为 sqs.New 的参数中的类型 *"github.com/aws/aws-sdk-go/aws".Config
</pre>

代码示例
<code>
svc := lambda.New(&amp;aws.Config{Region: "eu-west-1"})
</code>

英文:

I started to create a very light weight message broker to practice go, travis and some aws services all in one project.

My current problem is that I can build, run and test my develop branch on my local machine however when travis attempts to build it I get a compile error. The code it doesn't like came straight from AWS examples to further deepen the mystery for me.

Travis failed build
https://travis-ci.org/hevnly/eevy/builds/65687886

Github repo https://github.com/hevnly/eevy/tree/92412cf729ed546d698ded1e514d2d54c340ff81

Error
<pre>
handler/lambda.go:31: cannot use "github.com/awslabs/aws-sdk-go/aws".Config literal (type *"github.com/awslabs/aws-sdk-go/aws".Config) as type *"github.com/aws/aws-sdk-go/aws".Config in argument to lambda.New
handler/sqs.go:26: cannot use "github.com/awslabs/aws-sdk-go/aws".Config literal (type *"github.com/awslabs/aws-sdk-go/aws".Config) as type *"github.com/aws/aws-sdk-go/aws".Config in argument to sqs.New
</pre>

Sample of code
<code>
svc := lambda.New(&amp;aws.Config{Region: &quot;eu-west-1&quot;})
</code>

答案1

得分: 1

好的,我刚刚尝试使用go get命令获取您的存储库,并得到了相同的错误:

handler/lambda.go:29: 无法将 "github.com/awslabs/aws-sdk-go/aws".Config 字面量(类型为 *"github.com/awslabs/aws-sdk-go/aws".Config)作为 lambda.New 的参数类型 *"github.com/aws/aws-sdk-go/aws".Config
handler/sqs.go:26: 无法将 "github.com/awslabs/aws-sdk-go/aws".Config 字面量(类型为 *"github.com/awslabs/aws-sdk-go/aws".Config)作为 sqs.New 的参数类型 *"github.com/aws/aws-sdk-go/aws".Config

我建议您开始使用依赖管理器,这样您就可以在存储库内解决依赖关系,并在任何地方进行可重复构建。

我的建议是使用Godep,但也有其他选择。

英文:

Ok, I have just tried to go get your repo and got the same error:

handler/lambda.go:29: cannot use &quot;github.com/awslabs/aws-sdk-go/aws&quot;.Config literal (type *&quot;github.com/awslabs/aws-sdk-go/aws&quot;.Config) as type *&quot;github.com/aws/aws-sdk-go/aws&quot;.Config in argument to lambda.New
handler/sqs.go:26: cannot use &quot;github.com/awslabs/aws-sdk-go/aws&quot;.Config literal (type *&quot;github.com/awslabs/aws-sdk-go/aws&quot;.Config) as type *&quot;github.com/aws/aws-sdk-go/aws&quot;.Config in argument to sqs.New

I advice you to start using a dependency manager, so you will fix your dependencies inside your repo and have reproducible builds in any place.

My recommendation is Godep, but there are others out there.

huangapple
  • 本文由 发表于 2015年6月6日 21:55:10
  • 转载请务必保留本文链接:https://go.coder-hub.com/30683697.html
匿名

发表评论

匿名网友

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

确定