From e50fd86233cc542065b7ed3edc53c76d844d307c Mon Sep 17 00:00:00 2001 From: Simon Noetzlin Date: Thu, 20 Apr 2023 11:41:37 +0200 Subject: [PATCH 1/3] build: bump Go to v1.20 (#2409) * bump Go to 1.19 * Bump Go to 1.20 * update docs * Update docs/getting-started/installation.md Co-authored-by: lg <8335464+glnro@users.noreply.github.com> * bump golangci in gh workflow * set actions/checkout version back to v3.5.2 * change go-version from 1.20 to 1.20.x in actions/setup-go * nit in gh workflow * first attempt to use two diff go version in gh workflows * 2nd attempt * update changelog * set user in e2e.Dockerfile * Run E2E docker containers using nonroot * update revive linter rules * revert changes in e2e.Dockerfile * attempt to fix gh workflow and sonarcloud error --------- Co-authored-by: lg <8335464+glnro@users.noreply.github.com> (cherry picked from commit cb523c09bba68c1ac54e71bf4d4408628211532d) # Conflicts: # .github/workflows/lint.yml # .github/workflows/sim-label.yml # .github/workflows/sims.yml # .github/workflows/test.yml --- .github/workflows/lint.yml | 7 +++++- .github/workflows/release-sims.yml | 4 ++-- .github/workflows/release.yml | 2 +- .github/workflows/sim-label.yml | 7 +++++- .github/workflows/sims.yml | 14 ++++++++---- .github/workflows/test.yml | 19 ++++++++++++++-- .golangci.yml | 28 ++++++++++++++++++++++++ .goreleaser.yml | 2 +- CHANGELOG.md | 1 + Dockerfile | 2 +- Makefile | 6 ++--- contrib/Dockerfile.test | 2 +- docs/getting-started/installation.md | 11 +++++----- docs/hub-tutorials/join-testnet.md | 4 ++-- e2e.Dockerfile | 3 ++- go.mod | 2 +- tests/e2e/e2e_globalfee_proposal_test.go | 2 +- 17 files changed, 89 insertions(+), 27 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 62d0ef4c432..f6fafa3f695 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -17,10 +17,15 @@ jobs: steps: - uses: actions/setup-go@v3 with: +<<<<<<< HEAD go-version: 1.19 - uses: actions/checkout@v3.4.0 +======= + go-version: 1.20.x + - uses: actions/checkout@v3.5.2 +>>>>>>> cb523c0 (build: bump Go to v1.20 (#2409)) - name: golangci-lint 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.51.2 + version: v1.52.2 diff --git a/.github/workflows/release-sims.yml b/.github/workflows/release-sims.yml index 0537c4682d8..849e1fa56b4 100644 --- a/.github/workflows/release-sims.yml +++ b/.github/workflows/release-sims.yml @@ -26,7 +26,7 @@ jobs: steps: - uses: actions/setup-go@v3.0.0 with: - go-version: 1.18 + go-version: 1.20.x - name: Install runsim run: go install github.com/cosmos/tools/cmd/runsim@v1.0.0 - uses: actions/cache@v3.2.0 @@ -65,7 +65,7 @@ jobs: - uses: actions/checkout@v3.1.0 - uses: actions/setup-go@v3.0.0 with: - go-version: 1.18 + go-version: 1.20.x - uses: technote-space/get-diff-action@v6.0.1 with: PATTERNS: | diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 25f2bc591cd..a5e87c82dcb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,7 +18,7 @@ jobs: - name: install go uses: actions/setup-go@v3 with: - go-version: '1.18' + go-version: 1.20.x check-latest: true - name: Build Artifacts run: make distclean build-reproducible diff --git a/.github/workflows/sim-label.yml b/.github/workflows/sim-label.yml index 90b1d86a82a..99e79d7d21b 100644 --- a/.github/workflows/sim-label.yml +++ b/.github/workflows/sim-label.yml @@ -17,7 +17,7 @@ jobs: steps: - uses: actions/setup-go@v3.0.0 with: - go-version: 1.18 + go-version: 1.20.x - name: Install runsim run: go install github.com/cosmos/tools/cmd/runsim@v1.0.0 - uses: actions/cache@v3.2.0 @@ -33,8 +33,13 @@ jobs: - uses: actions/checkout@v3.1.0 - uses: actions/setup-go@v3.0.0 with: +<<<<<<< HEAD go-version: 1.18 - uses: actions/cache@v3.2.0 +======= + go-version: 1.20.x + - uses: actions/cache@v3.3.1 +>>>>>>> cb523c0 (build: bump Go to v1.20 (#2409)) with: path: ~/go/bin key: ${{ runner.os }}-go-runsim-binary diff --git a/.github/workflows/sims.yml b/.github/workflows/sims.yml index 4cde0dbe098..1d567882c21 100644 --- a/.github/workflows/sims.yml +++ b/.github/workflows/sims.yml @@ -21,7 +21,7 @@ jobs: steps: - uses: actions/setup-go@v3 with: - go-version: 1.18 + go-version: 1.20.x - name: Install runsim run: go install github.com/cosmos/tools/cmd/runsim@v1.0.0 - uses: actions/cache@v3.2.0 @@ -36,7 +36,7 @@ jobs: - uses: actions/checkout@v3.1.0 - uses: actions/setup-go@v3.0.0 with: - go-version: 1.18 + go-version: 1.20.x - uses: technote-space/get-diff-action@v6.0.1 with: PATTERNS: | @@ -60,7 +60,7 @@ jobs: - uses: actions/checkout@v3.1.0 - uses: actions/setup-go@v3 with: - go-version: 1.18 + go-version: 1.20.x - uses: technote-space/get-diff-action@v6 with: PATTERNS: | @@ -82,7 +82,7 @@ jobs: steps: - uses: actions/setup-go@v3.0.0 with: - go-version: 1.18 + go-version: 1.20.x - name: Install runsim run: go install github.com/cosmos/tools/cmd/runsim@v1.0.0 - uses: actions/cache@v3.2.0 @@ -107,9 +107,15 @@ jobs: steps: - uses: actions/setup-go@v3 with: +<<<<<<< HEAD go-version: 1.18 - uses: actions/checkout@v3.1.0 - uses: actions/cache@v3.2.0 +======= + go-version: 1.20.x + - uses: actions/checkout@v3.5.2 + - uses: actions/cache@v3.3.1 +>>>>>>> cb523c0 (build: bump Go to v1.20 (#2409)) with: path: ~/go/bin key: ${{ runner.os }}-go-runsim-binary diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ae13c5f02f4..730cda13f45 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -42,7 +42,7 @@ jobs: ${{ runner.os }}-go- - uses: actions/setup-go@v3.3.1 with: - go-version: 1.18 + go-version: 1.20.x - name: test & coverage report creation run: | go test -v -coverprofile=coverage.txt -covermode=atomic -coverpkg=./... $(go list ./... | grep -v -e '/tests/e2e') @@ -70,8 +70,13 @@ jobs: steps: - uses: actions/setup-go@v3.0.0 with: +<<<<<<< HEAD go-version: 1.18 - uses: actions/checkout@v3.1.0 +======= + go-version: 1.20.x + - uses: actions/checkout@v3.5.2 +>>>>>>> cb523c0 (build: bump Go to v1.20 (#2409)) - uses: technote-space/get-diff-action@v6.0.1 with: PATTERNS: | @@ -90,7 +95,7 @@ jobs: - uses: actions/checkout@v3.1.0 - uses: actions/setup-go@v3 with: - go-version: 1.18 + go-version: 1.20.x - uses: technote-space/get-diff-action@v6.0.1 with: PATTERNS: | @@ -117,21 +122,31 @@ jobs: - uses: actions/checkout@v3.1.0 with: fetch-depth: 0 +<<<<<<< HEAD - uses: actions/setup-go@v3 with: go-version: 1.18 +======= +>>>>>>> cb523c0 (build: bump Go to v1.20 (#2409)) - uses: technote-space/get-diff-action@v6.0.1 with: PATTERNS: | **/**.go go.mod go.sum + - uses: actions/setup-go@v4 + with: + go-version: 1.18 - name: Install GaiaV8 run: | git checkout v8.0.0-rc3 make build cp ./build/gaiad ./build/gaiad8 + go clean -modcache if: env.GIT_DIFF + - uses: actions/setup-go@v4 + with: + go-version: 1.20.x - name: Install GaiaV9 run: | git checkout - diff --git a/.golangci.yml b/.golangci.yml index b7bc83240ac..a9c0517397e 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -66,3 +66,31 @@ linters-settings: allow-leading-space: true require-explanation: false require-specific: false + revive: + ignore-generated-header: true + severity: warning + rules: + - name: unused-parameter + disabled: true + - name: blank-imports + - name: context-as-argument + - name: context-keys-type + - name: dot-imports + - name: error-return + - name: error-strings + - name: error-naming + - name: exported + - name: if-return + - name: increment-decrement + - name: var-naming + - name: var-declaration + - name: range + - name: receiver-naming + - name: time-naming + - name: unexported-return + - name: indent-error-flow + - name: errorf + - name: empty-block + - name: superfluous-else + - name: unreachable-code + - name: redefines-builtin-id \ No newline at end of file diff --git a/.goreleaser.yml b/.goreleaser.yml index ab9c3cb2e4d..6d204956745 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -6,7 +6,7 @@ env: before: hooks: - - go mod tidy -compat=1.18 + - go mod tidy -compat=1.20 builds: - main: ./cmd/gaiad diff --git a/CHANGELOG.md b/CHANGELOG.md index ee5e7b28dbb..56b76a3cc57 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,6 +35,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ # Changelog ## [Unreleased] +* (gaia) Bump Golang prerequisite from 1.18 to 1.20 see (https://go.dev/blog/go1.20) for details. ## [v9.1.0] - 2023-05-08 diff --git a/Dockerfile b/Dockerfile index 5caba870955..07546c6b8f6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ ARG IMG_TAG=latest # Compile the gaiad binary -FROM golang:1.18-alpine AS gaiad-builder +FROM golang:1.20-alpine AS gaiad-builder WORKDIR /src/app/ COPY go.mod go.sum* ./ RUN go mod download diff --git a/Makefile b/Makefile index 5ac542e9d1b..a09ec6ea85e 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,7 @@ BUILDDIR ?= $(CURDIR)/build TEST_DOCKER_REPO=cosmos/contrib-gaiatest GO_SYSTEM_VERSION = $(shell go version | cut -c 14- | cut -d' ' -f1 | cut -d'.' -f1-2) -REQUIRE_GO_VERSION = 1.18 +REQUIRE_GO_VERSION = 1.20 export GO111MODULE = on @@ -97,7 +97,7 @@ include contrib/devtools/Makefile check_version: ifneq ($(GO_SYSTEM_VERSION), $(REQUIRE_GO_VERSION)) - @echo "ERROR: Go version 1.18 is required for $(VERSION) of Gaia." + @echo "ERROR: Go version 1.20 is required for $(VERSION) of Gaia." exit 1 endif @@ -219,7 +219,7 @@ docker-build-all: docker-build-debug docker-build-hermes ### Linting ### ############################################################################### golangci_lint_cmd=golangci-lint -golangci_version=v1.50.1 +golangci_version=v1.52.2 lint: @echo "--> Running linter" diff --git a/contrib/Dockerfile.test b/contrib/Dockerfile.test index 8e909f7e8d2..df49e63fb95 100644 --- a/contrib/Dockerfile.test +++ b/contrib/Dockerfile.test @@ -2,7 +2,7 @@ # > docker build -t gaia . # > docker run -it -p 46657:46657 -p 46656:46656 -v ~/.gaia:/root/.gaia gaia gaiad init # > docker run -it -p 46657:46657 -p 46656:46656 -v ~/.gaia:/root/.gaia gaia gaiad start -FROM golang:1.18-alpine AS build-env +FROM golang:1.20-alpine AS build-env # Set up dependencies ENV PACKAGES curl make git libc-dev bash gcc linux-headers eudev-dev python3 diff --git a/docs/getting-started/installation.md b/docs/getting-started/installation.md index a145a7552f2..8ab82d1c25d 100644 --- a/docs/getting-started/installation.md +++ b/docs/getting-started/installation.md @@ -30,7 +30,7 @@ sudo apt-get install -y make gcc ## Install Go ::: tip -**Go 1.18+** is required. +**Go 1.20+** is required. ::: We suggest the following two ways to install Go. Check out the [official docs](https://golang.org/doc/install) and Go installer for the correct download for your operating system. Alternatively, you can install Go yourself from the command line. Detailed below are standard default installation locations, but feel free to customize. @@ -39,12 +39,13 @@ We suggest the following two ways to install Go. Check out the [official docs](h **Ubuntu:** -At the time of this writing, the latest release is `1.18.10`. We're going to download the tarball, extract it to `/usr/local`, and export `GOROOT` to our `$PATH` +At the time of this writing, the latest release is `1.20.3`. We're going to download the tarball, extract it to `/usr/local`, and export `GOROOT` to our `$PATH` ```bash -curl -OL https://golang.org/dl/go1.18.10.linux-amd64.tar.gz +curl -OL https://go.dev/dl/go1.20.3.linux-amd64.tar.gz + +sudo tar -C /usr/local -xvf https://go.dev/dl/go1.20.3.linux-amd64.tar.gz -sudo tar -C /usr/local -xvf go1.18.10.linux-amd64.tar.gz export PATH=$PATH:/usr/local/go/bin @@ -98,7 +99,7 @@ server_name: gaiad version: v9.0.0 commit: 682770f2410ab0d33ac7f0c7203519d7a99fa2b6 build_tags: netgo,ledger -go: go version go1.18.10 linux/amd64 +go: go version go1.20.3 linux/amd64 ``` ### Build Tags diff --git a/docs/hub-tutorials/join-testnet.md b/docs/hub-tutorials/join-testnet.md index 7aeff314906..3cc21471fdd 100644 --- a/docs/hub-tutorials/join-testnet.md +++ b/docs/hub-tutorials/join-testnet.md @@ -63,8 +63,8 @@ Install build tools and Go. ```shell sudo apt-get update sudo apt-get install -y make gcc -wget https://go.dev/dl/go1.18.5.linux-amd64.tar.gz -sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.18.5.linux-amd64.tar.gz +wget https://go.dev/dl/go1.20.3.linux-amd64.tar.gz +sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.20.3.linux-amd64.tar.gz export PATH=$PATH:/usr/local/go/bin ``` diff --git a/e2e.Dockerfile b/e2e.Dockerfile index c0a8c80a4e1..9dd74f65c7d 100644 --- a/e2e.Dockerfile +++ b/e2e.Dockerfile @@ -1,7 +1,7 @@ ARG IMG_TAG=latest # Compile the gaiad binary -FROM golang:1.18-alpine AS gaiad-builder +FROM golang:1.20-alpine AS gaiad-builder WORKDIR /src/app/ COPY go.mod go.sum* ./ RUN go mod download @@ -15,5 +15,6 @@ FROM cgr.dev/chainguard/static:$IMG_TAG ARG IMG_TAG COPY --from=gaiad-builder /go/bin/gaiad /usr/local/bin/ EXPOSE 26656 26657 1317 9090 +USER "nonroot" ENTRYPOINT ["gaiad", "start"] diff --git a/go.mod b/go.mod index 03c3f708698..44b0b0a92f8 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/cosmos/gaia/v9 -go 1.18 +go 1.20 require ( github.com/cosmos/cosmos-sdk v0.45.15-ics diff --git a/tests/e2e/e2e_globalfee_proposal_test.go b/tests/e2e/e2e_globalfee_proposal_test.go index 3f48007af6d..6da9b4575db 100644 --- a/tests/e2e/e2e_globalfee_proposal_test.go +++ b/tests/e2e/e2e_globalfee_proposal_test.go @@ -10,7 +10,7 @@ import ( paramtypes "github.com/cosmos/cosmos-sdk/x/params/types/proposal" ) -func (s *IntegrationTestSuite) govProposeNewGlobalfee(newGlobalfee sdk.DecCoins, proposalCounter int, submitter string, fees string) { //nolint:unparam +func (s *IntegrationTestSuite) govProposeNewGlobalfee(newGlobalfee sdk.DecCoins, proposalCounter int, submitter string, _ string) { s.writeGovParamChangeProposalGlobalFees(s.chainA, newGlobalfee) chainAAPIEndpoint := fmt.Sprintf("http://%s", s.valResources[s.chainA.id][0].GetHostPort("1317/tcp")) submitGovFlags := []string{"param-change", configFile(proposalGlobalFeeFilename)} From 04c081bd4700687ed560995a96f65cad90ae4b69 Mon Sep 17 00:00:00 2001 From: Shawn <44221603+smarshall-spitzbart@users.noreply.github.com> Date: Wed, 17 May 2023 15:36:07 -0700 Subject: [PATCH 2/3] fix conflicts --- .github/workflows/lint.yml | 5 ----- .github/workflows/sim-label.yml | 5 ----- .github/workflows/sims.yml | 6 ------ .github/workflows/test.yml | 6 ------ 4 files changed, 22 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index f6fafa3f695..310a02d819b 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -17,13 +17,8 @@ jobs: steps: - uses: actions/setup-go@v3 with: -<<<<<<< HEAD - go-version: 1.19 - - uses: actions/checkout@v3.4.0 -======= go-version: 1.20.x - uses: actions/checkout@v3.5.2 ->>>>>>> cb523c0 (build: bump Go to v1.20 (#2409)) - name: golangci-lint uses: golangci/golangci-lint-action@v3 with: diff --git a/.github/workflows/sim-label.yml b/.github/workflows/sim-label.yml index 99e79d7d21b..b3b60e4f424 100644 --- a/.github/workflows/sim-label.yml +++ b/.github/workflows/sim-label.yml @@ -33,13 +33,8 @@ jobs: - uses: actions/checkout@v3.1.0 - uses: actions/setup-go@v3.0.0 with: -<<<<<<< HEAD - go-version: 1.18 - - uses: actions/cache@v3.2.0 -======= go-version: 1.20.x - uses: actions/cache@v3.3.1 ->>>>>>> cb523c0 (build: bump Go to v1.20 (#2409)) with: path: ~/go/bin key: ${{ runner.os }}-go-runsim-binary diff --git a/.github/workflows/sims.yml b/.github/workflows/sims.yml index 1d567882c21..6a323c1859f 100644 --- a/.github/workflows/sims.yml +++ b/.github/workflows/sims.yml @@ -107,15 +107,9 @@ jobs: steps: - uses: actions/setup-go@v3 with: -<<<<<<< HEAD - go-version: 1.18 - - uses: actions/checkout@v3.1.0 - - uses: actions/cache@v3.2.0 -======= go-version: 1.20.x - uses: actions/checkout@v3.5.2 - uses: actions/cache@v3.3.1 ->>>>>>> cb523c0 (build: bump Go to v1.20 (#2409)) with: path: ~/go/bin key: ${{ runner.os }}-go-runsim-binary diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 730cda13f45..15d3393de61 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -122,12 +122,6 @@ jobs: - uses: actions/checkout@v3.1.0 with: fetch-depth: 0 -<<<<<<< HEAD - - uses: actions/setup-go@v3 - with: - go-version: 1.18 -======= ->>>>>>> cb523c0 (build: bump Go to v1.20 (#2409)) - uses: technote-space/get-diff-action@v6.0.1 with: PATTERNS: | From 74948d31e724186bcd83c32fe7201ec68326818f Mon Sep 17 00:00:00 2001 From: Shawn <44221603+smarshall-spitzbart@users.noreply.github.com> Date: Wed, 17 May 2023 15:37:38 -0700 Subject: [PATCH 3/3] missed one --- .github/workflows/test.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 15d3393de61..69b5bdd520d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -70,13 +70,8 @@ jobs: steps: - uses: actions/setup-go@v3.0.0 with: -<<<<<<< HEAD - go-version: 1.18 - - uses: actions/checkout@v3.1.0 -======= go-version: 1.20.x - uses: actions/checkout@v3.5.2 ->>>>>>> cb523c0 (build: bump Go to v1.20 (#2409)) - uses: technote-space/get-diff-action@v6.0.1 with: PATTERNS: |