Skip to content

Commit d6717ae

Browse files
authored
website: Update GitHub Actions example for setup-go@v4 and using go.mod version (#169)
Reference: https://github.com/actions/setup-go#getting-go-version-from-the-gomod-file This prevents developers from needing to continually update their testing workflow with Go upgrades, which can be pointed at the minimum Go version as defined by their Go module.
1 parent 18deced commit d6717ae

File tree

1 file changed

+13
-11
lines changed
  • website/docs/plugin/testing/acceptance-tests

1 file changed

+13
-11
lines changed

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

Lines changed: 13 additions & 11 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.19 and Terraform CLI 1.3:
139+
The following example workflow runs acceptance testing for the provider using the latest patch versions of the Go version in the `go.mod` file and Terraform CLI 1.5:
140140

141141
```yaml
142142
name: Terraform Provider Tests
@@ -157,12 +157,12 @@ jobs:
157157
runs-on: ubuntu-latest
158158
steps:
159159
- uses: actions/checkout@v3
160-
- uses: actions/setup-go@v3
160+
- uses: actions/setup-go@v4
161161
with:
162-
go-version: '1.19'
162+
go-version-file: 'go.mod'
163163
- uses: hashicorp/setup-terraform@v2
164164
with:
165-
terraform_version: '1.3.*'
165+
terraform_version: '1.5.*'
166166
terraform_wrapper: false
167167
- run: go test -v -cover ./...
168168
env:
@@ -172,14 +172,14 @@ jobs:
172172
runs-on: ubuntu-latest
173173
steps:
174174
- uses: actions/checkout@v3
175-
- uses: actions/setup-go@v3
175+
- uses: actions/setup-go@v4
176176
with:
177-
go-version: '1.19'
177+
go-version-file: 'go.mod'
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.19 and Terraform CLI 0.12 through 1.3:
182+
The following example workflow runs acceptance testing for the provider using the latest patch versions of Go version in the `go.mod` file and Terraform CLI 0.12 through 1.5:
183183

184184
```yaml
185185
name: Terraform Provider Tests
@@ -210,11 +210,13 @@ jobs:
210210
- '1.1.*'
211211
- '1.2.*'
212212
- '1.3.*'
213+
- '1.4.*'
214+
- '1.5.*'
213215
steps:
214216
- uses: actions/checkout@v3
215-
- uses: actions/setup-go@v3
217+
- uses: actions/setup-go@v4
216218
with:
217-
go-version: '1.19'
219+
go-version-file: 'go.mod'
218220
- uses: hashicorp/setup-terraform@v2
219221
with:
220222
terraform_version: ${{ matrix.terraform-version }}
@@ -227,9 +229,9 @@ jobs:
227229
runs-on: ubuntu-latest
228230
steps:
229231
- uses: actions/checkout@v3
230-
- uses: actions/setup-go@v3
232+
- uses: actions/setup-go@v4
231233
with:
232-
go-version: '1.19'
234+
go-version-file: 'go.mod'
233235
- run: go test -v -cover ./...
234236
```
235237

0 commit comments

Comments
 (0)