Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump Expected Minimum Go Version to 1.17 #934

Merged
merged 2 commits into from Apr 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/934.txt
@@ -0,0 +1,3 @@
```release-note:note
This Go module has been updated to Go 1.17 per the [Go support policy](https://golang.org/doc/devel/release.html#policy). Any consumers building on earlier Go versions may experience errors.
```
2 changes: 1 addition & 1 deletion .github/workflows/ci-go.yml
Expand Up @@ -56,7 +56,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: [ '1.17', '1.16' ]
go-version: [ '1.18', '1.17' ]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
Expand Down
2 changes: 1 addition & 1 deletion .go-version
@@ -1 +1 @@
1.16.7
1.17.8
2 changes: 1 addition & 1 deletion .golangci.yml
Expand Up @@ -21,7 +21,7 @@ linters:
# - paralleltest # Reference: https://github.com/kunwardeep/paralleltest/issues/14
- predeclared
- staticcheck
# - tenv # TODO: Enable when upgrading Go 1.16 to 1.17
- tenv
- unconvert
- unparam
- varcheck
Expand Down
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -14,9 +14,9 @@ When running provider tests, Terraform 0.12.26 or later is needed for version 2.

## Go Compatibility

The Terraform Plugin SDK is built in Go, and uses the [support policy](https://golang.org/doc/devel/release.html#policy) of Go as its support policy. The two latest major releases of Go are supported by the SDK.
This project follows the [support policy](https://golang.org/doc/devel/release.html#policy) of Go as its support policy. The two latest major releases of Go are supported by the project.

Currently, that means Go **1.16** or later must be used when building a provider with the SDK.
Currently, that means Go **1.17** or later must be used when including this project as a dependency.

## Getting Started

Expand Down
35 changes: 29 additions & 6 deletions go.mod
@@ -1,9 +1,8 @@
module github.com/hashicorp/terraform-plugin-sdk/v2

go 1.16
go 1.17

require (
github.com/agext/levenshtein v1.2.2 // indirect
github.com/apparentlymart/go-cidr v1.1.0
github.com/apparentlymart/go-dump v0.0.0-20190214190832-042adf3cf4a0
github.com/davecgh/go-spew v1.1.1
Expand All @@ -21,17 +20,41 @@ require (
github.com/hashicorp/terraform-json v0.13.0
github.com/hashicorp/terraform-plugin-go v0.8.0
github.com/hashicorp/terraform-plugin-log v0.3.0
github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d // indirect
github.com/kylelemons/godebug v1.1.0 // indirect
github.com/mitchellh/copystructure v1.2.0
github.com/mitchellh/go-testing-interface v1.14.1
github.com/mitchellh/go-wordwrap v1.0.0 // indirect
github.com/mitchellh/mapstructure v1.4.3
github.com/mitchellh/reflectwalk v1.0.2
github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect
github.com/zclconf/go-cty v1.10.0
golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e
golang.org/x/tools v0.0.0-20200713011307-fd294ab11aed
)

require (
github.com/agext/levenshtein v1.2.2 // indirect
github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect
github.com/fatih/color v1.7.0 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/hashicorp/errwrap v1.0.0 // indirect
github.com/hashicorp/go-checkpoint v0.5.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/terraform-registry-address v0.0.0-20210412075316-9b2996cce896 // indirect
github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734 // indirect
github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d // indirect
github.com/kylelemons/godebug v1.1.0 // indirect
github.com/mattn/go-colorable v0.1.4 // indirect
github.com/mattn/go-isatty v0.0.10 // indirect
github.com/mitchellh/go-wordwrap v1.0.0 // indirect
github.com/oklog/run v1.0.0 // indirect
github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect
github.com/vmihailenco/msgpack/v4 v4.3.12 // indirect
github.com/vmihailenco/tagparser v0.1.1 // indirect
golang.org/x/mod v0.3.0 // indirect
golang.org/x/net v0.0.0-20210326060303-6b1517762897 // indirect
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 // indirect
golang.org/x/text v0.3.5 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
google.golang.org/appengine v1.6.6 // indirect
google.golang.org/genproto v0.0.0-20200711021454-869866162049 // indirect
google.golang.org/grpc v1.45.0 // indirect
google.golang.org/protobuf v1.27.1 // indirect
)
22 changes: 5 additions & 17 deletions helper/schema/schema_test.go
Expand Up @@ -26,9 +26,7 @@ func TestEnvDefaultFunc(t *testing.T) {
defer os.Unsetenv(key)

f := EnvDefaultFunc(key, "42")
if err := os.Setenv(key, "foo"); err != nil {
t.Fatalf("err: %s", err)
}
t.Setenv(key, "foo")

actual, err := f()
if err != nil {
Expand Down Expand Up @@ -64,9 +62,7 @@ func TestMultiEnvDefaultFunc(t *testing.T) {

// Test that the first key is returned first
f := MultiEnvDefaultFunc(keys, "42")
if err := os.Setenv(keys[0], "foo"); err != nil {
t.Fatalf("err: %s", err)
}
t.Setenv(keys[0], "foo")

actual, err := f()
if err != nil {
Expand All @@ -82,9 +78,7 @@ func TestMultiEnvDefaultFunc(t *testing.T) {

// Test that the second key is returned if the first one is empty
f = MultiEnvDefaultFunc(keys, "42")
if err := os.Setenv(keys[1], "foo"); err != nil {
t.Fatalf("err: %s", err)
}
t.Setenv(keys[1], "foo")

actual, err = f()
if err != nil {
Expand Down Expand Up @@ -8474,25 +8468,19 @@ func TestValidateAtLeastOneOfAttributes(t *testing.T) {
}

func TestPanicOnErrorDefaultsFalse(t *testing.T) {
oldEnv := os.Getenv("TF_ACC")
t.Setenv("TF_ACC", "")

os.Setenv("TF_ACC", "")
if schemaMap(nil).panicOnError() {
t.Fatalf("panicOnError should be false when TF_ACC is empty")
}

os.Setenv("TF_ACC", oldEnv)
}

func TestPanicOnErrorTF_ACCSet(t *testing.T) {
oldEnv := os.Getenv("TF_ACC")
t.Setenv("TF_ACC", "1")

os.Setenv("TF_ACC", "1")
if !schemaMap(nil).panicOnError() {
t.Fatalf("panicOnError should be true when TF_ACC is not empty")
}

os.Setenv("TF_ACC", oldEnv)
}

func TestValidateRequiredWithAttributes(t *testing.T) {
Expand Down