Skip to content

Commit 41970b4

Browse files
committed
Merge branch 'main' into HEAD
2 parents 9b884bd + a9b8900 commit 41970b4

18 files changed

+840
-768
lines changed

.github/workflows/modern_go.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Modern Go Check
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- "release/**"
8+
pull_request:
9+
paths:
10+
- "**/*.go"
11+
- .github/workflows/modern_go.yml
12+
13+
## NOTE: !!!
14+
## When changing these workflows, ensure that the following is updated:
15+
## - Documentation: docs/continuous-integration.md
16+
## - Documentation: docs/makefile-cheat-sheet.md
17+
## - Makefile: ./GNUmakefile
18+
19+
jobs:
20+
copywrite:
21+
name: Check for modern Go
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
25+
- uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
26+
with:
27+
go-version-file: go.mod
28+
# See also: https://github.com/actions/setup-go/issues/54
29+
- name: go env
30+
run: |
31+
echo "GOCACHE=$(go env GOCACHE)" >> $GITHUB_ENV
32+
- uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2
33+
continue-on-error: true
34+
timeout-minutes: 2
35+
with:
36+
path: ${{ env.GOCACHE }}
37+
key: ${{ runner.os }}-GOCACHE-${{ hashFiles('go.sum') }}-${{ hashFiles('internal/**') }}
38+
- uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2
39+
continue-on-error: true
40+
timeout-minutes: 2
41+
with:
42+
path: ~/go/pkg/mod
43+
key: ${{ runner.os }}-go-pkg-mod-${{ hashFiles('go.sum') }}
44+
- run: make TEST=./internal/service/mq modern-check
45+
- run: make TEST=./internal/service/wafv2 modern-check

GNUmakefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,10 @@ lint-fix: testacc-lint-fix website-lint-fix docs-lint-fix ## Fix acceptance test
326326

327327
misspell: changelog-misspell docs-misspell website-misspell go-misspell ## [CI] Run all CI misspell checks
328328

329+
modern-check: prereq-go ## [CI] Check for modern Go code (best run in individual services)
330+
@echo "make: Checking for modern Go code..."
331+
@$(GO_VER) run golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@latest -test $(TEST)
332+
329333
prereq-go: ## If $(GO_VER) is not installed, install it
330334
@if ! type "$(GO_VER)" > /dev/null 2>&1 ; then \
331335
echo "make: $(GO_VER) not found" ; \
@@ -888,6 +892,7 @@ yamllint: ## [CI] YAML Linting / yamllint
888892
lint-fix \
889893
lint \
890894
misspell \
895+
modern-check \
891896
prereq-go \
892897
provider-lint \
893898
provider-markdown-lint \

docs/continuous-integration.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,10 @@ PKG=rds make golangci-lint2
254254

255255
GoReleaser CI build-32-bit ensures that GoReleaser can build a 32-bit binary. This check catches rare but important edge cases. Currently, we do not offer a `make` target to run this check locally.
256256

257+
### Modern Go Check
258+
259+
This check ensures that code uses current idiomatic Go. Currently, the check is only run on a subset of services. To determine which services must have modern Go, check the `.github/workflows/modern_go.yml` file.
260+
257261
### Provider Checks
258262

259263
Provider checks are a suite of tests that ensure Go code functions and markdown is correct.

docs/makefile-cheat-sheet.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ Variables are often defined before the `make` call on the same line, such as `MY
132132
| `lint`<sup>M</sup> | Legacy target, use caution | | ✔️ | |
133133
| `lint-fix`<sup>M</sup> | Fix acceptance test, website, and docs linter findings | | ✔️ | |
134134
| `misspell`<sup>M</sup> | Run all CI misspell checks | ✔️ | | |
135+
| `modern-check` | Check for modern GO | ✔️ | | `TEST` |
135136
| `prereq-go` | Install the project's Go version | | | `GO_VER` |
136137
| `provider-lint` | ProviderLint Checks / providerlint | ✔️ | | `K`, `PKG`, `SVC_DIR` |
137138
| `provider-markdown-lint` | Provider Check / markdown-lint | ✔️ | | |
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
resource/aws_wafv2_web_acl: Add `rule.challenge_config` argument
3+
```

0 commit comments

Comments
 (0)