构建自定义 Terraform 提供程序时出现错误。

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

Building a custom terraform provider errors out

问题

我在尝试编译GO代码时遇到了这个错误:

[root@scsor0014444001 Netapp]# go build -o terraform-provider-xxxx

github.com/hashicorp/terraform/config

../go/src/github.com/hashicorp/terraform/config/testing.go:9: t.Helper undefined (type *testing.T has no field or method Helper)

[root@scsor0014444001 Netapp]# go version
go version go1.8.3 linux/amd64

有人可以帮我理解这里出了什么问题吗?

提前感谢!

英文:

I am hitting this error while i try to compile GO code

[root@scsor0014444001 Netapp]# go build -o terraform-provider-xxxx
# github.com/hashicorp/terraform/config
../go/src/github.com/hashicorp/terraform/config/testing.go:9: t.Helper undefined (type *testing.T has no field or method Helper)

[root@scsor0014444001 Netapp]# go version
go version go1.8.3 linux/amd64

Can someone help me in understanding whats wrong here ?

Thanks in advance!

答案1

得分: 1

从0.10.3版本开始,Terraform核心现在需要Go 1.9,因为使用了新的“test helper”功能。

由于提供程序依赖于核心系统的一些包作为库,这种依赖性不幸地也被提供程序继承了。如果您正在使用“vendoring”将Terraform核心提供给提供程序(推荐!),那么您可以将vendored版本回滚到此更改之前的最终提交以便使用1.8构建,尽管随着时间的推移,这种策略当然会导致vendored包落后于最新的更改。

升级Go到1.9应该以更持久的方式解决这个问题。

英文:

As of the 0.10.3 release, Terraform core now requires Go 1.9 due to the use of the new "test helper" feature.

Since providers depend on some packages from the core system as libraries, this dependency is unfortunately then inherited by the providers too. If you're using vendoring to make Terraform core available to the provider (recommended!) then you can potentially wind back the vendored version to the final commit before this change in order to build with 1.8, though over time this strategy will of course cause the vendored package to fall behind the latest changes.

Upgrading Go to 1.9 should address this in a more permanent way.

huangapple
  • 本文由 发表于 2017年8月30日 17:52:25
  • 转载请务必保留本文链接:https://go.coder-hub.com/45957208.html
匿名

发表评论

匿名网友

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

确定