Skip to content

Commit 28f7b22

Browse files
authored
all: Bump Go Version to 1.18 (#1027)
Reference: #834 Reference: #1026 Reference: hashicorp/terraform-website#2279 Updates everything for Go 1.18 by running the following: ```shell go mod edit -go=1.18 go mod tidy go fix ./... ``` And updating textual files such as GitHub Actions workflows and the README.
1 parent 156a638 commit 28f7b22

File tree

9 files changed

+26
-59
lines changed

9 files changed

+26
-59
lines changed

.changelog/1027.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:note
2+
This Go module has been updated to Go 1.18 per the [Go support policy](https://golang.org/doc/devel/release.html#policy). Any consumers building on earlier Go versions may experience errors.
3+
```

.github/workflows/ci-go.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
runs-on: ubuntu-latest
4949
strategy:
5050
matrix:
51-
go-version: [ '1.18', '1.17' ]
51+
go-version: [ '1.19', '1.18' ]
5252
steps:
5353
- uses: actions/checkout@v3
5454
- uses: actions/setup-go@v3

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ When running provider tests, Terraform 0.12.26 or later is needed for version 2.
1818

1919
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.
2020

21-
Currently, that means Go **1.17** or later must be used when including this project as a dependency.
21+
Currently, that means Go **1.18** or later must be used when including this project as a dependency.
2222

2323
## Getting Started
2424

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/hashicorp/terraform-plugin-sdk/v2
22

3-
go 1.17
3+
go 1.18
44

55
require (
66
github.com/apparentlymart/go-cidr v1.1.0

go.sum

Lines changed: 0 additions & 27 deletions
Large diffs are not rendered by default.

helper/schema/provider_go115_test.go

Lines changed: 0 additions & 6 deletions
This file was deleted.

helper/schema/provider_prego115_test.go

Lines changed: 0 additions & 6 deletions
This file was deleted.

helper/schema/provider_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ import (
1818
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
1919
)
2020

21+
const invalidDurationErrMsg = "time: invalid duration \"invalid\""
22+
2123
func TestProviderGetSchema(t *testing.T) {
2224
// This functionality is already broadly tested in core_schema_test.go,
2325
// so this is just to ensure that the call passes through correctly.

website/docs/plugin/sdkv2/testing/acceptance-tests/index.mdx

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ Create a [GitHub Actions workflow](https://docs.github.com/en/actions/using-work
136136

137137
Use the [`matrix`](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstrategymatrix) strategy for more advanced configuration, such as running acceptance testing against multiple Terraform CLI versions.
138138

139-
The following example workflow runs acceptance testing for the provider using the latest patch versions of Go 1.17 and Terraform CLI 1.1:
139+
The following example workflow runs acceptance testing for the provider using the latest patch versions of Go 1.18 and Terraform CLI 1.2:
140140

141141
```yaml
142142
name: Terraform Provider Tests
@@ -156,13 +156,13 @@ jobs:
156156
name: Acceptance Tests
157157
runs-on: ubuntu-latest
158158
steps:
159-
- uses: actions/checkout@v2
160-
- uses: actions/setup-go@v2
159+
- uses: actions/checkout@v3
160+
- uses: actions/setup-go@v3
161161
with:
162-
go-version: '1.17'
163-
- uses: hashicorp/setup-terraform@v1
162+
go-version: '1.18'
163+
- uses: hashicorp/setup-terraform@v2
164164
with:
165-
terraform_version: '1.1.*'
165+
terraform_version: '1.2.*'
166166
terraform_wrapper: false
167167
- run: go test -v -cover ./...
168168
env:
@@ -171,15 +171,15 @@ jobs:
171171
name: Unit Tests
172172
runs-on: ubuntu-latest
173173
steps:
174-
- uses: actions/checkout@v2
175-
- uses: actions/setup-go@v2
174+
- uses: actions/checkout@v3
175+
- uses: actions/setup-go@v3
176176
with:
177-
go-version: '1.17'
177+
go-version: '1.18'
178178
- run: go test -v -cover ./...
179179
```
180180
181181
182-
The following example workflow runs acceptance testing for the provider using the latest patch versions of Go 1.17 and Terraform CLI 0.12 through 1.1:
182+
The following example workflow runs acceptance testing for the provider using the latest patch versions of Go 1.18 and Terraform CLI 0.12 through 1.2:
183183
184184
```yaml
185185
name: Terraform Provider Tests
@@ -208,12 +208,13 @@ jobs:
208208
- '0.15.*'
209209
- '1.0.*'
210210
- '1.1.*'
211+
- '1.2.*'
211212
steps:
212-
- uses: actions/checkout@v2
213-
- uses: actions/setup-go@v2
213+
- uses: actions/checkout@v3
214+
- uses: actions/setup-go@v3
214215
with:
215-
go-version: '1.17'
216-
- uses: hashicorp/setup-terraform@v1
216+
go-version: '1.18'
217+
- uses: hashicorp/setup-terraform@v2
217218
with:
218219
terraform_version: ${{ matrix.terraform-version }}
219220
terraform_wrapper: false
@@ -224,10 +225,10 @@ jobs:
224225
name: Unit Tests
225226
runs-on: ubuntu-latest
226227
steps:
227-
- uses: actions/checkout@v2
228-
- uses: actions/setup-go@v2
228+
- uses: actions/checkout@v3
229+
- uses: actions/setup-go@v3
229230
with:
230-
go-version: '1.17'
231+
go-version: '1.18'
231232
- run: go test -v -cover ./...
232233
```
233234

0 commit comments

Comments
 (0)