From 675423f0804bbc190a5a867a79cd05726315fed9 Mon Sep 17 00:00:00 2001 From: Burak Sekili Date: Fri, 8 Dec 2023 14:38:25 +0300 Subject: [PATCH 1/3] upgrade go version to 1.21 Signed-off-by: Burak Sekili --- .github/workflows/linter.yaml | 2 +- .github/workflows/release_nightly.yaml | 2 +- .github/workflows/run_tests.yaml | 2 +- .golangci.yml | 2 +- CHANGELOG.md | 3 +++ Dockerfile | 2 +- go.mod | 2 +- go.sum | 1 + 8 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/linter.yaml b/.github/workflows/linter.yaml index 09b1eb50e..0bad1691f 100644 --- a/.github/workflows/linter.yaml +++ b/.github/workflows/linter.yaml @@ -20,7 +20,7 @@ jobs: steps: - uses: actions/setup-go@v3 with: - go-version: 1.19 + go-version: 1.21 - name: check out code uses: actions/checkout@v3 - name: golangci-lint diff --git a/.github/workflows/release_nightly.yaml b/.github/workflows/release_nightly.yaml index 740c35075..23ba6364b 100644 --- a/.github/workflows/release_nightly.yaml +++ b/.github/workflows/release_nightly.yaml @@ -20,7 +20,7 @@ jobs: - name: Install Go uses: actions/setup-go@v3 with: - go-version: 1.19.x + go-version: 1.21.x - name: Run GoReleaser uses: goreleaser/goreleaser-action@v2 with: diff --git a/.github/workflows/run_tests.yaml b/.github/workflows/run_tests.yaml index de94790de..26041ec94 100644 --- a/.github/workflows/run_tests.yaml +++ b/.github/workflows/run_tests.yaml @@ -62,7 +62,7 @@ jobs: - name: Install Go uses: actions/setup-go@v3 with: - go-version: 1.19.x + go-version: 1.21.x - name: Cache Go Modules uses: actions/cache@v3 diff --git a/.golangci.yml b/.golangci.yml index 402b4a2c4..24171ef12 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -40,7 +40,7 @@ linters-settings: extra-rules: true # Select the Go version to target. - lang-version: "1.19" + lang-version: "1.21" lll: # Max line length; lines longer will be reported diff --git a/CHANGELOG.md b/CHANGELOG.md index 50e319e15..b1b72d752 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ **Added**: - Added `imagePullSecrets` configuration for ServiceAccount in Tyk Operator Helm chart +**Updated** +- Updated Go version to 1.21 + ## [v0.15.1](https://github.com/TykTechnologies/tyk-operator/tree/v0.15.1) [Full Changelog](https://github.com/TykTechnologies/tyk-operator/compare/v0.15.0...v0.15.1) diff --git a/Dockerfile b/Dockerfile index 51be2769e..180f8db5f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Build the manager binary -FROM golang:1.19 as builder +FROM golang:1.21 as builder WORKDIR /workspace # Copy the Go Modules manifests diff --git a/go.mod b/go.mod index e79e5d243..289ac7111 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/TykTechnologies/tyk-operator -go 1.19 +go 1.21 require ( github.com/TykTechnologies/graphql-go-tools v1.6.2-0.20221207092329-acdd20d63048 diff --git a/go.sum b/go.sum index 395cea846..4a130c084 100644 --- a/go.sum +++ b/go.sum @@ -888,6 +888,7 @@ golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= From 82e1defd605101236bb2621f1506f2ff1c4201e7 Mon Sep 17 00:00:00 2001 From: Burak Sekili Date: Mon, 11 Dec 2023 11:47:33 +0300 Subject: [PATCH 2/3] use copy of the tc in order to prevent running range variables in the func literals Signed-off-by: Burak Sekili --- controllers/ingress_controller_test.go | 2 ++ controllers/operatorcontext_controller_test.go | 2 ++ 2 files changed, 4 insertions(+) diff --git a/controllers/ingress_controller_test.go b/controllers/ingress_controller_test.go index 21f8fb28c..87a949195 100644 --- a/controllers/ingress_controller_test.go +++ b/controllers/ingress_controller_test.go @@ -64,6 +64,8 @@ func TestBuildAPIName(t *testing.T) { } for n, tc := range tests { + tc := tc + t.Run(n, func(t *testing.T) { t.Parallel() result := reconciler.buildAPIName(tc.Namespace, tc.Name, tc.Hash) diff --git a/controllers/operatorcontext_controller_test.go b/controllers/operatorcontext_controller_test.go index 4cd9e6366..ce87dc9a1 100644 --- a/controllers/operatorcontext_controller_test.go +++ b/controllers/operatorcontext_controller_test.go @@ -125,6 +125,8 @@ func TestOperatorContextDelete(t *testing.T) { } for n, tc := range tests { + tc := tc + t.Run(n, func(t *testing.T) { t.Parallel() From 85df9032fb6dfeb8cb96c6f5697878be0ae28497 Mon Sep 17 00:00:00 2001 From: Burak Sekili Date: Mon, 11 Dec 2023 11:55:23 +0300 Subject: [PATCH 3/3] update golangci lint version Signed-off-by: Burak Sekili --- .github/workflows/linter.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linter.yaml b/.github/workflows/linter.yaml index 0bad1691f..1a0f27ee6 100644 --- a/.github/workflows/linter.yaml +++ b/.github/workflows/linter.yaml @@ -27,7 +27,7 @@ jobs: uses: golangci/golangci-lint-action@v3 with: # Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version - version: v1.50.1 + version: v1.55.2 # Optional: golangci-lint command line arguments. args: --verbose --timeout=5m