From 808954bfaa44c12f0eea9d0268ad22d1a3ed92a0 Mon Sep 17 00:00:00 2001 From: Yuan Tang Date: Wed, 3 May 2023 10:17:53 -0400 Subject: [PATCH 1/7] fix: Upgrade Go to v1.20. Fixes #11023 Signed-off-by: Yuan Tang --- .github/workflows/ci-build.yaml | 8 ++++---- .github/workflows/gh-pages.yaml | 2 +- .github/workflows/release.yaml | 2 +- Dockerfile | 2 +- Dockerfile.windows | 2 +- go.mod | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci-build.yaml b/.github/workflows/ci-build.yaml index ec04ef99dd02..f6bc01abe61a 100644 --- a/.github/workflows/ci-build.yaml +++ b/.github/workflows/ci-build.yaml @@ -25,7 +25,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-go@v4 with: - go-version: "1.19" + go-version: "1.20" cache: true - run: make test STATIC_FILES=false GOTEST='go test -p 20 -covermode=atomic -coverprofile=coverage.out' # engineers just ignore this in PRs, so lets not even run it @@ -102,7 +102,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-go@v4 with: - go-version: "1.19" + go-version: "1.20" cache: true - uses: actions/setup-java@v3 if: ${{matrix.test == 'test-java-sdk'}} @@ -202,7 +202,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-go@v4 with: - go-version: "1.19" + go-version: "1.20" cache: true - name: Install protoc run: | @@ -235,7 +235,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-go@v4 with: - go-version: "1.19" + go-version: "1.20" cache: true - run: make lint STATIC_FILES=false - run: git diff --exit-code diff --git a/.github/workflows/gh-pages.yaml b/.github/workflows/gh-pages.yaml index 30d51c85d022..0ccc55d04d04 100644 --- a/.github/workflows/gh-pages.yaml +++ b/.github/workflows/gh-pages.yaml @@ -25,7 +25,7 @@ jobs: python-version: 3.9 - uses: actions/setup-go@v4 with: - go-version: '1.19' + go-version: '1.20' - uses: actions/setup-node@v3 with: node-version: "19" diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index b0a54b0d60ee..1eea359403cb 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -385,7 +385,7 @@ jobs: node-version: "16" - uses: actions/setup-go@v4 with: - go-version: "1.19" + go-version: "1.20" - uses: actions/cache@v3 with: path: ui/node_modules diff --git a/Dockerfile b/Dockerfile index d5b141d67390..2c920468efab 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,7 @@ ARG GIT_COMMIT=unknown ARG GIT_TAG=unknown ARG GIT_TREE_STATE=unknown -FROM golang:1.19-alpine3.16 as builder +FROM golang:1.20-alpine3.16 as builder RUN apk update && apk add --no-cache \ git \ diff --git a/Dockerfile.windows b/Dockerfile.windows index b80d41fc9627..49151c1ed482 100644 --- a/Dockerfile.windows +++ b/Dockerfile.windows @@ -11,7 +11,7 @@ ARG GIT_TREE_STATE=unknown # had issues with official golange image for windows so I'm using plain servercore FROM mcr.microsoft.com/windows/servercore:${IMAGE_OS_VERSION} as builder -ENV GOLANG_VERSION=1.19 +ENV GOLANG_VERSION=1.20 SHELL ["powershell", "-Command"] # install chocolatey package manager diff --git a/go.mod b/go.mod index 407d7b54bf08..8ed71005d50d 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/argoproj/argo-workflows/v3 -go 1.19 +go 1.20 require ( cloud.google.com/go/storage v1.30.1 From 395c7b3eec481b1370462d26bac1cde9733fd0d3 Mon Sep 17 00:00:00 2001 From: Yuan Tang Date: Wed, 3 May 2023 11:24:37 -0400 Subject: [PATCH 2/7] fix: use 1.19 for lint check Signed-off-by: Yuan Tang --- .github/workflows/ci-build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-build.yaml b/.github/workflows/ci-build.yaml index f6bc01abe61a..d541ad6f0ae6 100644 --- a/.github/workflows/ci-build.yaml +++ b/.github/workflows/ci-build.yaml @@ -235,7 +235,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-go@v4 with: - go-version: "1.20" + go-version: "1.19" cache: true - run: make lint STATIC_FILES=false - run: git diff --exit-code From cb7ecd6d50380681b14b7093ba81dac059ae7b95 Mon Sep 17 00:00:00 2001 From: Yuan Tang Date: Wed, 3 May 2023 14:37:58 -0400 Subject: [PATCH 3/7] Revert "fix: use 1.19 for lint check" This reverts commit 395c7b3eec481b1370462d26bac1cde9733fd0d3. --- .github/workflows/ci-build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-build.yaml b/.github/workflows/ci-build.yaml index d541ad6f0ae6..f6bc01abe61a 100644 --- a/.github/workflows/ci-build.yaml +++ b/.github/workflows/ci-build.yaml @@ -235,7 +235,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-go@v4 with: - go-version: "1.19" + go-version: "1.20" cache: true - run: make lint STATIC_FILES=false - run: git diff --exit-code From 367fd8b2bf1b9dfae4f1f7e8a8f8bf9c184a5854 Mon Sep 17 00:00:00 2001 From: Yuan Tang Date: Wed, 3 May 2023 16:44:31 -0400 Subject: [PATCH 4/7] Update Makefile --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index b43e6fc149cc..ff9d3c7a3024 100644 --- a/Makefile +++ b/Makefile @@ -401,7 +401,7 @@ dist/manifests/%: manifests/% # lint/test/etc $(GOPATH)/bin/golangci-lint: - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b `go env GOPATH`/bin v1.49.0 + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b `go env GOPATH`/bin v1.52.2 .PHONY: lint lint: server/static/files.go $(GOPATH)/bin/golangci-lint From 1b6d97b124edf9300c2e7d48485632ede0614e39 Mon Sep 17 00:00:00 2001 From: Yuan Tang Date: Wed, 3 May 2023 22:22:33 -0400 Subject: [PATCH 5/7] fix: lint Signed-off-by: Yuan Tang --- .golangci.yml | 3 ++- pkg/apiclient/http1/facade.go | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.golangci.yml b/.golangci.yml index f0b13cf5ee53..e9de691ae418 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -61,7 +61,8 @@ issues: exclude: # We are leaving io/ioutil for now to make backports easier # https://github.com/argoproj/argo-workflows/pull/6964#issuecomment-946827019 - - "SA1019: \"io/ioutil\" has been deprecated since Go 1.16" + - "SA1019: \"io/ioutil\" has been deprecated since Go 1.19" + - "SA1019: rand.Seed has been deprecated since Go 1.20" exclude-rules: - path: server/artifacts/artifact_server_test.go text: "response body must be closed" diff --git a/pkg/apiclient/http1/facade.go b/pkg/apiclient/http1/facade.go index 597b1f315ebd..a14d7deb2e2a 100644 --- a/pkg/apiclient/http1/facade.go +++ b/pkg/apiclient/http1/facade.go @@ -76,6 +76,7 @@ func (h Facade) EventStreamReader(in interface{}, path string) (*bufio.Reader, e if err != nil { return nil, err } + defer resp.Body.Close() err = errFromResponse(resp) if err != nil { return nil, err From 0493c03b8ca3e1cbe6cf9d77be71490f22040309 Mon Sep 17 00:00:00 2001 From: Yuan Tang Date: Wed, 3 May 2023 23:05:06 -0400 Subject: [PATCH 6/7] fix: fix Signed-off-by: Yuan Tang --- pkg/apiclient/http1/facade.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/apiclient/http1/facade.go b/pkg/apiclient/http1/facade.go index a14d7deb2e2a..67a78886a4f6 100644 --- a/pkg/apiclient/http1/facade.go +++ b/pkg/apiclient/http1/facade.go @@ -76,12 +76,13 @@ func (h Facade) EventStreamReader(in interface{}, path string) (*bufio.Reader, e if err != nil { return nil, err } - defer resp.Body.Close() err = errFromResponse(resp) if err != nil { return nil, err } - return bufio.NewReader(resp.Body), nil + rd := bufio.NewReader(resp.Body) + defer resp.Body.Close() + return rd, nil } func (h Facade) do(in interface{}, out interface{}, method string, path string) error { From 11be6a6db49a5c6622deb8e87e900ec3605b88f9 Mon Sep 17 00:00:00 2001 From: Yuan Tang Date: Wed, 3 May 2023 23:24:52 -0400 Subject: [PATCH 7/7] fix: fix Signed-off-by: Yuan Tang --- pkg/apiclient/http1/facade.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pkg/apiclient/http1/facade.go b/pkg/apiclient/http1/facade.go index 67a78886a4f6..17ecde268331 100644 --- a/pkg/apiclient/http1/facade.go +++ b/pkg/apiclient/http1/facade.go @@ -72,7 +72,7 @@ func (h Facade) EventStreamReader(in interface{}, path string) (*bufio.Reader, e }, }, } - resp, err := client.Do(req) + resp, err := client.Do(req) //nolint if err != nil { return nil, err } @@ -80,9 +80,7 @@ func (h Facade) EventStreamReader(in interface{}, path string) (*bufio.Reader, e if err != nil { return nil, err } - rd := bufio.NewReader(resp.Body) - defer resp.Body.Close() - return rd, nil + return bufio.NewReader(resp.Body), nil } func (h Facade) do(in interface{}, out interface{}, method string, path string) error {