Skip to content

Commit 2a2347c

Browse files
authored
chore: bump to Go 1.22 (#375)
* chore: bump to Go 1.22 * ci: fix CI by bumping Go in dockerfiles Also checkout codebase before setup go * chore(deps): bump golangci-lint * lint: gofumpt file * fix: WriteFile permissions Inspired by: cosmos@ac74e23 Fixes thislint error: crypto/keyring/keyring.go:722:14: G306: Expect WriteFile permissions to be 0600 or less (gosec) if err := os.WriteFile(dir+"/keyhash", passwordHash, 0o555); err != nil { * fix: resolve implicit memory aliasing in for loop Inspired by: https://github.com/cosmos/cosmos-sdk/blob/28801fc666f1c33f315e815bd57f2952fd6e0b00/x/group/keeper/keeper.go#L390 * lint: remove depguard Not used on cosmos-sdk main branch * lint: resolve nakedret
1 parent 0244d0c commit 2a2347c

File tree

23 files changed

+246
-192
lines changed

23 files changed

+246
-192
lines changed

Diff for: .github/workflows/codeql-analysis.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ jobs:
2323
steps:
2424
- name: Checkout repository
2525
uses: actions/checkout@v3
26-
- uses: actions/setup-go@v3
26+
- uses: actions/setup-go@v5
2727
with:
28-
go-version: 1.19
28+
go-version-file: go.mod
2929
# Initializes the CodeQL tools for scanning.
3030
- name: Initialize CodeQL
3131
uses: github/codeql-action/init@v2

Diff for: .github/workflows/lint.yml

+4-5
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,11 @@ jobs:
1616
name: golangci-lint
1717
runs-on: ubuntu-latest
1818
steps:
19-
- uses: actions/setup-go@v3
20-
with:
21-
go-version: 1.19
2219
- uses: actions/checkout@v3
20+
- uses: actions/setup-go@v5
21+
with:
22+
go-version-file: 'go.mod'
2323
- name: golangci-lint
2424
uses: golangci/golangci-lint-action@v3
2525
with:
26-
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
27-
version: v1.49.0
26+
version: v1.56.2

Diff for: .github/workflows/release.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ jobs:
1313
steps:
1414
- uses: actions/checkout@v3
1515
- name: Install Go
16-
uses: actions/setup-go@v3
16+
uses: actions/setup-go@v5
1717
with:
18-
go-version: 1.19
18+
go-version-file: 'go.mod'
1919
- name: Unshallow
2020
run: git fetch --prune --unshallow
2121
- name: Create release

Diff for: .github/workflows/sims.yml

+11-10
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ jobs:
2121
if: "!contains(github.event.head_commit.message, 'skip-sims')"
2222
steps:
2323
- uses: actions/checkout@v3
24-
- uses: actions/setup-go@v3
24+
- uses: actions/setup-go@v5
2525
with:
26-
go-version: 1.19
26+
go-version-file: 'go.mod'
2727
- name: Display go version
2828
run: go version
2929
- run: make build
@@ -32,9 +32,10 @@ jobs:
3232
runs-on: ubuntu-latest
3333
needs: build
3434
steps:
35-
- uses: actions/setup-go@v3
35+
- uses: actions/checkout@v3
36+
- uses: actions/setup-go@v5
3637
with:
37-
go-version: 1.19
38+
go-version-file: 'go.mod'
3839
- name: Display go version
3940
run: go version
4041
- name: Install runsim
@@ -50,9 +51,9 @@ jobs:
5051
timeout-minutes: 60
5152
steps:
5253
- uses: actions/checkout@v3
53-
- uses: actions/setup-go@v3
54+
- uses: actions/setup-go@v5
5455
with:
55-
go-version: 1.19
56+
go-version-file: 'go.mod'
5657
- name: Display go version
5758
run: go version
5859
- uses: actions/cache@v3
@@ -69,9 +70,9 @@ jobs:
6970
timeout-minutes: 60
7071
steps:
7172
- uses: actions/checkout@v3
72-
- uses: actions/setup-go@v3
73+
- uses: actions/setup-go@v5
7374
with:
74-
go-version: 1.19
75+
go-version-file: 'go.mod'
7576
- name: Display go version
7677
run: go version
7778
- uses: actions/cache@v3
@@ -88,9 +89,9 @@ jobs:
8889
timeout-minutes: 60
8990
steps:
9091
- uses: actions/checkout@v3
91-
- uses: actions/setup-go@v3
92+
- uses: actions/setup-go@v5
9293
with:
93-
go-version: 1.19
94+
go-version-file: 'go.mod'
9495
- name: Display go version
9596
run: go version
9697
- uses: actions/cache@v3

Diff for: .github/workflows/test-race.yml

+9-8
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@ jobs:
2222
install-tparse:
2323
runs-on: ubuntu-latest
2424
steps:
25-
- uses: actions/setup-go@v3
25+
- uses: actions/checkout@v3
26+
- uses: actions/setup-go@v5
2627
with:
27-
go-version: 1.19
28+
go-version-file: 'go.mod'
2829
- name: Display go version
2930
run: go version
3031
- name: install tparse
@@ -38,9 +39,9 @@ jobs:
3839
runs-on: ubuntu-latest
3940
steps:
4041
- uses: actions/checkout@v3
41-
- uses: actions/setup-go@v3
42+
- uses: actions/setup-go@v5
4243
with:
43-
go-version: 1.19
44+
go-version-file: 'go.mod'
4445
- uses: technote-space/[email protected]
4546
id: git_diff
4647
with:
@@ -55,9 +56,9 @@ jobs:
5556
runs-on: ubuntu-latest
5657
steps:
5758
- uses: actions/checkout@v3
58-
- uses: actions/setup-go@v3
59+
- uses: actions/setup-go@v5
5960
with:
60-
go-version: 1.19
61+
go-version-file: 'go.mod'
6162
- name: Create a file with all core Cosmos SDK pkgs
6263
run: go list ./... > pkgs.txt
6364
- name: Split pkgs into 4 files
@@ -89,9 +90,9 @@ jobs:
8990
part: ["00", "01", "02", "03"]
9091
steps:
9192
- uses: actions/checkout@v3
92-
- uses: actions/setup-go@v3
93+
- uses: actions/setup-go@v5
9394
with:
94-
go-version: 1.19
95+
go-version-file: 'go.mod'
9596
- uses: technote-space/[email protected]
9697
with:
9798
PATTERNS: |

Diff for: .github/workflows/test.yml

+15-14
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ jobs:
2626
go-arch: ["amd64", "arm", "arm64"]
2727
steps:
2828
- uses: actions/checkout@v3
29-
- uses: actions/setup-go@v3
29+
- uses: actions/setup-go@v5
3030
with:
31-
go-version: 1.19
31+
go-version-file: 'go.mod'
3232
- uses: technote-space/[email protected]
3333
id: git_diff
3434
with:
@@ -44,9 +44,9 @@ jobs:
4444
container: tendermintdev/docker-tm-db-testing
4545
steps:
4646
- uses: actions/checkout@v3
47-
- uses: actions/setup-go@v3
47+
- uses: actions/setup-go@v5
4848
with:
49-
go-version: 1.19
49+
go-version-file: 'go.mod'
5050
- uses: technote-space/[email protected]
5151
id: git_diff
5252
with:
@@ -67,9 +67,9 @@ jobs:
6767
runs-on: ubuntu-latest
6868
steps:
6969
- uses: actions/checkout@v3
70-
- uses: actions/setup-go@v3
70+
- uses: actions/setup-go@v5
7171
with:
72-
go-version: 1.19
72+
go-version-file: 'go.mod'
7373
- name: Create a file with all core Cosmos SDK pkgs
7474
run: go list ./... > pkgs.txt
7575
- name: Split pkgs into 4 files
@@ -101,9 +101,9 @@ jobs:
101101
part: ["00", "01", "02", "03"]
102102
steps:
103103
- uses: actions/checkout@v3
104-
- uses: actions/setup-go@v3
104+
- uses: actions/setup-go@v5
105105
with:
106-
go-version: 1.19
106+
go-version-file: 'go.mod'
107107
- uses: technote-space/[email protected]
108108
with:
109109
PATTERNS: |
@@ -180,9 +180,9 @@ jobs:
180180
timeout-minutes: 15
181181
steps:
182182
- uses: actions/checkout@v3
183-
- uses: actions/setup-go@v3
183+
- uses: actions/setup-go@v5
184184
with:
185-
go-version: 1.19
185+
go-version-file: 'go.mod'
186186
- uses: technote-space/[email protected]
187187
id: git_diff
188188
with:
@@ -203,9 +203,10 @@ jobs:
203203
runs-on: ubuntu-latest
204204
needs: build
205205
steps:
206-
- uses: actions/setup-go@v3
206+
- uses: actions/checkout@v3
207+
- uses: actions/setup-go@v5
207208
with:
208-
go-version: 1.19
209+
go-version-file: 'go.mod'
209210
- name: Display go version
210211
run: go version
211212
- name: Install runsim
@@ -220,9 +221,9 @@ jobs:
220221
needs: [build, install-runsim]
221222
steps:
222223
- uses: actions/checkout@v3
223-
- uses: actions/setup-go@v3
224+
- uses: actions/setup-go@v5
224225
with:
225-
go-version: 1.19
226+
go-version-file: 'go.mod'
226227
- name: Display go version
227228
run: go version
228229
- uses: technote-space/[email protected]

Diff for: .golangci.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ run:
66
linters:
77
disable-all: true
88
enable:
9-
- depguard
109
- dogsled
1110
- exportloopref
1211
- goconst
@@ -58,4 +57,4 @@ linters-settings:
5857
nolintlint:
5958
allow-unused: false
6059
require-explanation: false
61-
require-specific: false
60+
require-specific: false

Diff for: Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
# > docker run -it -p 26657:26657 -p 26656:26656 -v ~/.simappcli:/root/.simapp simapp simd keys add foo
1111
# > docker run -it -p 26657:26657 -p 26656:26656 -v ~/.simappcli:/root/.simapp simapp simd keys list
1212
# TODO: demo connecting rest-server (or is this in server now?)
13-
FROM golang:1.19-alpine AS build-env
13+
FROM golang:1.22.1-alpine AS build-env
1414

1515
# Install minimum necessary dependencies
1616
ENV PACKAGES curl make git libc-dev bash gcc linux-headers eudev-dev python3

Diff for: Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ benchmark:
326326
###############################################################################
327327

328328
golangci_lint_cmd=golangci-lint
329-
golangci_version=v1.49.0
329+
golangci_version=v1.56.2
330330

331331
lint:
332332
@echo "--> Running linter"

Diff for: baseapp/abci.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func (app *BaseApp) InitChain(req abci.RequestInitChain) (res abci.ResponseInitC
6666
}
6767

6868
if app.initChainer == nil {
69-
return
69+
return res
7070
}
7171

7272
// add block gas meter for any genesis transactions (allow infinite gas)

Diff for: contrib/devtools/Dockerfile

+7-7
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
FROM bufbuild/buf:1.1.0 as BUILDER
66

7-
FROM golang:1.19-alpine
7+
FROM golang:1.22.1-alpine
88

99
RUN apk add --no-cache \
1010
nodejs \
@@ -20,19 +20,19 @@ ENV GOLANG_PROTOBUF_VERSION=1.28.0 \
2020
RUN go install github.com/cosmos/cosmos-proto/cmd/protoc-gen-go-pulsar@latest
2121
RUN go install google.golang.org/protobuf/cmd/protoc-gen-go@v${GOLANG_PROTOBUF_VERSION}
2222
RUN go install github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway@v${GRPC_GATEWAY_VERSION} \
23-
github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger@v${GRPC_GATEWAY_VERSION}
23+
github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger@v${GRPC_GATEWAY_VERSION}
2424

2525
# install all gogo protobuf binaries
2626
RUN git clone https://github.com/regen-network/protobuf.git; \
27-
cd protobuf; \
28-
go mod download; \
29-
make install
27+
cd protobuf; \
28+
go mod download; \
29+
make install
3030

3131
# we need to use git clone because we use 'replace' directive in go.mod
3232
# protoc-gen-gocosmos was moved to to in cosmos/gogoproto but pending a migration there.
3333
RUN git clone https://github.com/regen-network/cosmos-proto.git; \
34-
cd cosmos-proto/protoc-gen-gocosmos; \
35-
go install .
34+
cd cosmos-proto/protoc-gen-gocosmos; \
35+
go install .
3636

3737
RUN npm install -g swagger-combine
3838

Diff for: contrib/images/simd-dlv/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.19-alpine AS build
1+
FROM golang:1.22.1-alpine AS build
22

33
RUN apk add build-base git linux-headers libc-dev
44
RUN go install github.com/go-delve/delve/cmd/dlv@latest

Diff for: contrib/images/simd-env/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.19-alpine AS build
1+
FROM golang:1.22.1-alpine AS build
22

33
RUN apk add build-base git linux-headers
44

Diff for: contrib/rosetta/rosetta-ci/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.19-alpine as build
1+
FROM golang:1.22.1-alpine as build
22

33
RUN apk add --no-cache tar git
44

Diff for: contrib/rosetta/rosetta-cli/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.19-alpine as build
1+
FROM golang:1.22.1-alpine as build
22

33
RUN apk add git gcc libc-dev --no-cache
44

Diff for: crypto/keyring/keyring.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -719,7 +719,7 @@ func newRealPrompt(dir string, buf io.Reader) func(string) (string, error) {
719719
continue
720720
}
721721

722-
if err := os.WriteFile(dir+"/keyhash", passwordHash, 0o555); err != nil {
722+
if err := os.WriteFile(dir+"/keyhash", passwordHash, 0o600); err != nil {
723723
return "", err
724724
}
725725

0 commit comments

Comments
 (0)