Skip to content

Commit f95a434

Browse files
authored
chore: upgrade to Go 1.22 (celestiaorg#1249)
## Motivation Part of celestiaorg#1248 We want to cut a release of celestia-core with Go 1.22 support to enable celestia-node to bump to Go 1.22. ## Description 1. Upgrade to Go 1.22 2. Bump pyroscope deps 3. Copy over golangci-lint config from CometBFT v0.34.x branch 4. Resolve a few lint issues by copying code from CometBFT v0.34.x branch
1 parent 9110107 commit f95a434

26 files changed

+221
-101
lines changed

Diff for: .github/workflows/check-generated.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
# steps:
2020
# - uses: actions/setup-go@v3
2121
# with:
22-
# go-version: "1.19"
22+
# go-version: "1.22"
2323

2424
# - uses: actions/checkout@v3
2525

@@ -43,7 +43,7 @@ jobs:
4343
steps:
4444
- uses: actions/setup-go@v4
4545
with:
46-
go-version: '1.19'
46+
go-version: '1.22'
4747

4848
- uses: actions/checkout@v4
4949
with:

Diff for: .github/workflows/coverage.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
- uses: actions/checkout@v4
1313
- uses: actions/setup-go@v4
1414
with:
15-
go-version: "1.19"
15+
go-version: "1.22"
1616
- name: Create a file with all the pkgs
1717
run: go list ./... > pkgs.txt
1818
- name: Split pkgs into 4 files
@@ -48,7 +48,7 @@ jobs:
4848
steps:
4949
- uses: actions/setup-go@v4
5050
with:
51-
go-version: "1.19"
51+
go-version: "1.22"
5252
- uses: actions/checkout@v4
5353
- uses: technote-space/get-diff-action@v6
5454
with:
@@ -70,7 +70,7 @@ jobs:
7070
steps:
7171
- uses: actions/setup-go@v4
7272
with:
73-
go-version: "1.19"
73+
go-version: "1.22"
7474
- uses: actions/checkout@v4
7575
- uses: technote-space/get-diff-action@v6
7676
with:

Diff for: .github/workflows/e2e-manual.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
steps:
1717
- uses: actions/setup-go@v4
1818
with:
19-
go-version: '1.19'
19+
go-version: '1.22'
2020

2121
- uses: actions/checkout@v4
2222

Diff for: .github/workflows/e2e-nightly-34x.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
steps:
2424
- uses: actions/setup-go@v4
2525
with:
26-
go-version: '1.19'
26+
go-version: '1.22'
2727

2828
- uses: actions/checkout@v4
2929
with:

Diff for: .github/workflows/e2e.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
steps:
1515
- uses: actions/setup-go@v4
1616
with:
17-
go-version: '1.19'
17+
go-version: '1.22'
1818
- uses: actions/checkout@v4
1919
- uses: technote-space/get-diff-action@v6
2020
with:

Diff for: .github/workflows/fuzz-nightly.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
steps:
1212
- uses: actions/setup-go@v4
1313
with:
14-
go-version: '1.19'
14+
go-version: '1.22'
1515

1616
- uses: actions/checkout@v4
1717

Diff for: .github/workflows/govulncheck.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ on:
1818
# steps:
1919
# - uses: actions/setup-go@v3
2020
# with:
21-
# go-version: "1.19"
21+
# go-version: "1.22"
2222
# - uses: actions/checkout@v3
2323
# - uses: technote-space/get-diff-action@v6
2424
# with:

Diff for: .github/workflows/lint.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- uses: actions/checkout@v4
2323
- uses: actions/setup-go@v4
2424
with:
25-
go-version: '1.19'
25+
go-version: '1.22'
2626
- uses: technote-space/get-diff-action@v6
2727
with:
2828
PATTERNS: |
@@ -34,7 +34,7 @@ jobs:
3434
# Required: the version of golangci-lint is required and
3535
# must be specified without patch version: we always use the
3636
# latest patch version.
37-
version: v1.50.1
37+
version: v1.56.2
3838
args: --timeout 10m
3939
github-token: ${{ secrets.github_token }}
4040
if: env.GIT_DIFF

Diff for: .github/workflows/pre-release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818

1919
- uses: actions/setup-go@v4
2020
with:
21-
go-version: '1.19'
21+
go-version: '1.22'
2222

2323
# Similar check to ./release-version.yml, but enforces this when pushing
2424
# tags. The ./release-version.yml check can be bypassed and is mainly

Diff for: .github/workflows/release-version.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515

1616
- uses: actions/setup-go@v4
1717
with:
18-
go-version: '1.19'
18+
go-version: '1.22'
1919

2020
- name: Check version
2121
run: |

Diff for: .github/workflows/release.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616

1717
- uses: actions/setup-go@v4
1818
with:
19-
go-version: '1.19'
19+
go-version: '1.22'
2020

2121
- name: Generate release notes
2222
run: |
@@ -32,4 +32,3 @@ jobs:
3232
args: release --clean --release-notes ../release_notes.md
3333
env:
3434
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35-

Diff for: .github/workflows/tests.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
steps:
2626
- uses: actions/setup-go@v4
2727
with:
28-
go-version: "1.19"
28+
go-version: "1.22"
2929
- uses: actions/checkout@v4
3030
- uses: technote-space/get-diff-action@v6
3131
with:
@@ -57,7 +57,7 @@ jobs:
5757
steps:
5858
- uses: actions/setup-go@v4
5959
with:
60-
go-version: "1.19"
60+
go-version: "1.22"
6161
- uses: actions/checkout@v4
6262
- uses: technote-space/get-diff-action@v6
6363
with:
@@ -89,7 +89,7 @@ jobs:
8989
steps:
9090
- uses: actions/setup-go@v4
9191
with:
92-
go-version: "1.19"
92+
go-version: "1.22"
9393
- uses: actions/checkout@v4
9494
- uses: technote-space/get-diff-action@v6
9595
with:
@@ -121,7 +121,7 @@ jobs:
121121
# steps:
122122
# - uses: actions/setup-go@v3
123123
# with:
124-
# go-version: "1.19"
124+
# go-version: "1.22"
125125
# - uses: actions/checkout@v3
126126
# - uses: technote-space/get-diff-action@v6
127127
# with:

Diff for: .golangci.yml

+84-6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
run:
2+
skip-files:
3+
- "libs/pubsub/query/query.peg.go"
4+
15
linters:
26
enable:
37
- asciicheck
@@ -10,13 +14,13 @@ linters:
1014
- goconst
1115
- gofmt
1216
- goimports
13-
- revive
17+
#- revive
1418
- gosec
1519
- gosimple
1620
- govet
1721
- ineffassign
1822
- misspell
19-
- nakedret
23+
#- nakedret
2024
- nolintlint
2125
- prealloc
2226
- staticcheck
@@ -31,6 +35,13 @@ issues:
3135
- path: _test\.go
3236
linters:
3337
- gosec
38+
- staticcheck
39+
- nolintlint
40+
- path: test/fuzz/
41+
linters:
42+
- gosec
43+
- nolintlint
44+
- staticcheck
3445
max-same-issues: 50
3546

3647
linters-settings:
@@ -40,7 +51,74 @@ linters-settings:
4051
min-confidence: 0
4152
maligned:
4253
suggest-new: true
43-
44-
run:
45-
skip-files:
46-
- libs/pubsub/query/query.peg.go
54+
goconst:
55+
ignore-tests: true
56+
depguard:
57+
rules:
58+
main:
59+
files:
60+
- $all
61+
- "!$test"
62+
allow:
63+
- $gostd
64+
- github.com/tendermint
65+
- github.com/cometbft
66+
- github.com/cosmos
67+
- github.com/gogo
68+
- github.com/Workiva/go-datastructures
69+
- github.com/ChainSafe/go-schnorrkel
70+
- github.com/creachadair/taskgroup
71+
- github.com/gtank/merlin
72+
- github.com/btcsuite/btcd/btcec/v2
73+
- github.com/BurntSushi/toml
74+
- github.com/go-git/go-git/v5
75+
- github.com/go-kit
76+
- github.com/go-logfmt/logfmt
77+
- github.com/gofrs/uuid
78+
- github.com/google
79+
- github.com/gorilla/websocket
80+
- github.com/informalsystems/tm-load-test/pkg/loadtest
81+
- github.com/lib/pq
82+
- github.com/libp2p/go-buffer-pool
83+
- github.com/Masterminds/semver/v3
84+
- github.com/minio/highwayhash
85+
- github.com/oasisprotocol/curve25519-voi
86+
- github.com/pkg/errors
87+
- github.com/prometheus
88+
- github.com/rcrowley/go-metrics
89+
- github.com/rs/cors
90+
- github.com/snikch/goodman
91+
- github.com/spf13
92+
- github.com/stretchr/testify/require
93+
- github.com/syndtr/goleveldb
94+
# celestia-core specific
95+
- github.com/influxdata/influxdb-client-go/v2
96+
- github.com/grafana/pyroscope-go
97+
- github.com/grafana/otel-profiling-go
98+
- github.com/celestiaorg/nmt
99+
test:
100+
files:
101+
- "$test"
102+
allow:
103+
- $gostd
104+
- github.com/cosmos
105+
- github.com/tendermint
106+
- github.com/cometbft
107+
- github.com/gogo
108+
- github.com/Workiva/go-datastructures
109+
- github.com/ChainSafe/go-schnorrkel
110+
- github.com/creachadair/taskgroup
111+
- github.com/gtank/merlin
112+
- github.com/adlio/schema
113+
- github.com/btcsuite/btcd
114+
- github.com/fortytw2/leaktest
115+
- github.com/go-kit
116+
- github.com/google/uuid
117+
- github.com/gorilla/websocket
118+
- github.com/lib/pq
119+
- github.com/oasisprotocol/curve25519-voi/primitives/merlin
120+
- github.com/ory/dockertest
121+
- github.com/pkg/errors
122+
- github.com/prometheus/client_golang/prometheus/promhttp
123+
- github.com/spf13
124+
- github.com/stretchr/testify

Diff for: DOCKER/Dockerfile

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Use a build arg to ensure that both stages use the same,
22
# hopefully current, go version.
3-
ARG GOLANG_BASE_IMAGE=golang:1.19-alpine
3+
ARG GOLANG_BASE_IMAGE=golang:1.22-alpine
44

55
# stage 1 Generate CometBFT Binary
66
FROM --platform=$BUILDPLATFORM $GOLANG_BASE_IMAGE as builder
@@ -58,4 +58,3 @@ CMD ["node"]
5858

5959
# Expose the data directory as a volume since there's mutable state in there
6060
VOLUME [ "$CMTHOME" ]
61-

Diff for: Makefile

+5-5
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ endif
154154

155155
proto-gen: check-proto-deps
156156
@echo "Generating Protobuf files"
157-
@go run github.com/bufbuild/buf/cmd/buf generate
157+
@go run github.com/bufbuild/buf/cmd/buf@v1.29.0 generate
158158
@mv ./proto/tendermint/abci/types.pb.go ./abci/types/
159159
@cp ./proto/tendermint/rpc/grpc/types.pb.go ./rpc/grpc
160160
.PHONY: proto-gen
@@ -163,7 +163,7 @@ proto-gen: check-proto-deps
163163
# execution only.
164164
proto-lint: check-proto-deps
165165
@echo "Linting Protobuf files"
166-
@go run github.com/bufbuild/buf/cmd/buf lint
166+
@go run github.com/bufbuild/buf/cmd/buf@v1.29.0 lint
167167
.PHONY: proto-lint
168168

169169
proto-format: check-proto-format-deps
@@ -176,11 +176,11 @@ proto-check-breaking: check-proto-deps
176176
@echo "Note: This is only useful if your changes have not yet been committed."
177177
@echo " Otherwise read up on buf's \"breaking\" command usage:"
178178
@echo " https://docs.buf.build/breaking/usage"
179-
@go run github.com/bufbuild/buf/cmd/buf breaking --against ".git"
179+
@go run github.com/bufbuild/buf/cmd/buf@v1.29.0 breaking --against ".git"
180180
.PHONY: proto-check-breaking
181181

182182
proto-check-breaking-ci:
183-
@go run github.com/bufbuild/buf/cmd/buf breaking --against $(HTTPS_GIT)#branch=v0.34.x-celestia
183+
@go run github.com/bufbuild/buf/cmd/buf@v1.29.0 breaking --against $(HTTPS_GIT)#branch=v0.34.x-celestia
184184
.PHONY: proto-check-breaking-ci
185185

186186
###############################################################################
@@ -259,7 +259,7 @@ format:
259259

260260
lint:
261261
@echo "--> Running linter"
262-
@go run github.com/golangci/golangci-lint/cmd/golangci-lint run
262+
@go run github.com/golangci/golangci-lint/cmd/golangci-lint@v1.56.2 run
263263
.PHONY: lint
264264

265265
vulncheck:

Diff for: README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ This repo intends on preserving the minimal possible diff with [cometbft/cometbf
5050
- **specific to Celestia**: consider if [celestia-app](https://github.com/celestiaorg/celestia-app) is a better target
5151
- **not specific to Celestia**: consider making the contribution upstream in CometBFT
5252

53-
1. [Install Go](https://go.dev/doc/install) 1.19+
53+
1. [Install Go](https://go.dev/doc/install) 1.22+
5454
2. Fork this repo
5555
3. Clone your fork
5656
4. Find an issue to work on (see [good first issues](https://github.com/celestiaorg/celestia-core/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22))

0 commit comments

Comments
 (0)