英文:
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(&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(&aws.Config{Region: "eu-west-1"})
</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 "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
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论