Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: bump Go to v1.20 (backport #2409) #2499

Merged
merged 3 commits into from
May 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jobs:
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.19
- uses: actions/checkout@v3.4.0
go-version: 1.20.x
- uses: actions/checkout@v3.5.2
- 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
4 changes: 2 additions & 2 deletions .github/workflows/release-sims.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
steps:
- uses: actions/[email protected]
with:
go-version: 1.18
go-version: 1.20.x
- name: Install runsim
run: go install github.com/cosmos/tools/cmd/[email protected]
- uses: actions/[email protected]
Expand Down Expand Up @@ -65,7 +65,7 @@ jobs:
- uses: actions/[email protected]
- uses: actions/[email protected]
with:
go-version: 1.18
go-version: 1.20.x
- uses: technote-space/[email protected]
with:
PATTERNS: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/sim-label.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
steps:
- uses: actions/[email protected]
with:
go-version: 1.18
go-version: 1.20.x
- name: Install runsim
run: go install github.com/cosmos/tools/cmd/[email protected]
- uses: actions/[email protected]
Expand All @@ -33,8 +33,8 @@ jobs:
- uses: actions/[email protected]
- uses: actions/[email protected]
with:
go-version: 1.18
- uses: actions/cache@v3.2.0
go-version: 1.20.x
- uses: actions/cache@v3.3.1
with:
path: ~/go/bin
key: ${{ runner.os }}-go-runsim-binary
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/sims.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]
- uses: actions/[email protected]
Expand All @@ -36,7 +36,7 @@ jobs:
- uses: actions/[email protected]
- uses: actions/[email protected]
with:
go-version: 1.18
go-version: 1.20.x
- uses: technote-space/[email protected]
with:
PATTERNS: |
Expand All @@ -60,7 +60,7 @@ jobs:
- uses: actions/[email protected]
- uses: actions/setup-go@v3
with:
go-version: 1.18
go-version: 1.20.x
- uses: technote-space/get-diff-action@v6
with:
PATTERNS: |
Expand All @@ -82,7 +82,7 @@ jobs:
steps:
- uses: actions/[email protected]
with:
go-version: 1.18
go-version: 1.20.x
- name: Install runsim
run: go install github.com/cosmos/tools/cmd/[email protected]
- uses: actions/[email protected]
Expand All @@ -107,9 +107,9 @@ jobs:
steps:
- uses: actions/setup-go@v3
with:
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
with:
path: ~/go/bin
key: ${{ runner.os }}-go-runsim-binary
Expand Down
18 changes: 11 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
${{ runner.os }}-go-
- uses: actions/[email protected]
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')
Expand Down Expand Up @@ -70,8 +70,8 @@ jobs:
steps:
- uses: actions/[email protected]
with:
go-version: 1.18
- uses: actions/checkout@v3.1.0
go-version: 1.20.x
- uses: actions/checkout@v3.5.2
- uses: technote-space/[email protected]
with:
PATTERNS: |
Expand All @@ -90,7 +90,7 @@ jobs:
- uses: actions/[email protected]
- uses: actions/setup-go@v3
with:
go-version: 1.18
go-version: 1.20.x
- uses: technote-space/[email protected]
with:
PATTERNS: |
Expand All @@ -117,21 +117,25 @@ jobs:
- uses: actions/[email protected]
with:
fetch-depth: 0
- uses: actions/setup-go@v3
with:
go-version: 1.18
- uses: technote-space/[email protected]
with:
PATTERNS: |
**/**.go
go.mod
go.sum
- uses: actions/setup-go@v4
with:
go-version: 1.18
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- 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 -
Expand Down
28 changes: 28 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ env:

before:
hooks:
- go mod tidy -compat=1.18
- go mod tidy -compat=1.20

builds:
- main: ./cmd/gaiad
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion contrib/Dockerfile.test
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 6 additions & 5 deletions docs/getting-started/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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

Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions docs/hub-tutorials/join-testnet.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```

Expand Down
3 changes: 2 additions & 1 deletion e2e.Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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"]
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/e2e_globalfee_proposal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)}
Expand Down