Skip to content

Commit

Permalink
all: Bump Go Version to 1.18 (#1027)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bflad committed Aug 11, 2022
1 parent 156a638 commit 28f7b22
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 59 deletions.
3 changes: 3 additions & 0 deletions .changelog/1027.txt
@@ -0,0 +1,3 @@
```release-note:note
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.
```
2 changes: 1 addition & 1 deletion .github/workflows/ci-go.yml
Expand Up @@ -48,7 +48,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: [ '1.18', '1.17' ]
go-version: [ '1.19', '1.18' ]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
Expand Down
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -18,7 +18,7 @@ When running provider tests, Terraform 0.12.26 or later is needed for version 2.

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.17** or later must be used when including this project as a dependency.
Currently, that means Go **1.18** or later must be used when including this project as a dependency.

## Getting Started

Expand Down
2 changes: 1 addition & 1 deletion go.mod
@@ -1,6 +1,6 @@
module github.com/hashicorp/terraform-plugin-sdk/v2

go 1.17
go 1.18

require (
github.com/apparentlymart/go-cidr v1.1.0
Expand Down
27 changes: 0 additions & 27 deletions go.sum

Large diffs are not rendered by default.

6 changes: 0 additions & 6 deletions helper/schema/provider_go115_test.go

This file was deleted.

6 changes: 0 additions & 6 deletions helper/schema/provider_prego115_test.go

This file was deleted.

2 changes: 2 additions & 0 deletions helper/schema/provider_test.go
Expand Up @@ -18,6 +18,8 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
)

const invalidDurationErrMsg = "time: invalid duration \"invalid\""

func TestProviderGetSchema(t *testing.T) {
// This functionality is already broadly tested in core_schema_test.go,
// so this is just to ensure that the call passes through correctly.
Expand Down
35 changes: 18 additions & 17 deletions website/docs/plugin/sdkv2/testing/acceptance-tests/index.mdx
Expand Up @@ -136,7 +136,7 @@ Create a [GitHub Actions workflow](https://docs.github.com/en/actions/using-work

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.

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

```yaml
name: Terraform Provider Tests
Expand All @@ -156,13 +156,13 @@ jobs:
name: Acceptance Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: '1.17'
- uses: hashicorp/setup-terraform@v1
go-version: '1.18'
- uses: hashicorp/setup-terraform@v2
with:
terraform_version: '1.1.*'
terraform_version: '1.2.*'
terraform_wrapper: false
- run: go test -v -cover ./...
env:
Expand All @@ -171,15 +171,15 @@ jobs:
name: Unit Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: '1.17'
go-version: '1.18'
- run: go test -v -cover ./...
```


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:
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:

```yaml
name: Terraform Provider Tests
Expand Down Expand Up @@ -208,12 +208,13 @@ jobs:
- '0.15.*'
- '1.0.*'
- '1.1.*'
- '1.2.*'
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: '1.17'
- uses: hashicorp/setup-terraform@v1
go-version: '1.18'
- uses: hashicorp/setup-terraform@v2
with:
terraform_version: ${{ matrix.terraform-version }}
terraform_wrapper: false
Expand All @@ -224,10 +225,10 @@ jobs:
name: Unit Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: '1.17'
go-version: '1.18'
- run: go test -v -cover ./...
```

Expand Down

0 comments on commit 28f7b22

Please sign in to comment.