Skip to content

Commit f95a434

Browse files
authoredFeb 29, 2024··
chore: upgrade to Go 1.22 (#1249)
## Motivation Part of #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
 

‎.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:

‎.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:

‎.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

‎.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:

‎.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:

‎.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

‎.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:

‎.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

‎.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

‎.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: |

‎.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-

‎.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:

‎.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

‎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-

‎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:

‎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))

‎go.mod

+18-17
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/tendermint/tendermint
22

3-
go 1.19
3+
go 1.22
44

55
require (
66
github.com/BurntSushi/toml v1.2.1
@@ -26,6 +26,8 @@ require (
2626
github.com/google/orderedcode v0.0.1
2727
github.com/google/uuid v1.3.1
2828
github.com/gorilla/websocket v1.5.0
29+
github.com/grafana/otel-profiling-go v0.5.1
30+
github.com/grafana/pyroscope-go v1.1.1
2931
github.com/gtank/merlin v0.1.1
3032
github.com/influxdata/influxdb-client-go/v2 v2.12.2
3133
github.com/informalsystems/tm-load-test v1.3.0
@@ -35,22 +37,20 @@ require (
3537
github.com/ory/dockertest v3.3.5+incompatible
3638
github.com/pkg/errors v0.9.1
3739
github.com/prometheus/client_golang v1.14.0
38-
github.com/pyroscope-io/client v0.7.2
39-
github.com/pyroscope-io/otel-profiling-go v0.4.0
4040
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475
4141
github.com/rs/cors v1.8.3
4242
github.com/sasha-s/go-deadlock v0.3.1
4343
github.com/snikch/goodman v0.0.0-20171125024755-10e37e294daa
4444
github.com/spf13/cobra v1.6.1
4545
github.com/spf13/viper v1.15.0
46-
github.com/stretchr/testify v1.8.2
46+
github.com/stretchr/testify v1.8.4
4747
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7
4848
github.com/vektra/mockery/v2 v2.23.1
49-
go.opentelemetry.io/otel v1.15.1
50-
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.15.1
51-
go.opentelemetry.io/otel/sdk v1.15.1
52-
golang.org/x/crypto v0.14.0
53-
golang.org/x/net v0.17.0
49+
go.opentelemetry.io/otel v1.24.0
50+
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.18.0
51+
go.opentelemetry.io/otel/sdk v1.24.0
52+
golang.org/x/crypto v0.17.0
53+
golang.org/x/net v0.19.0
5454
gonum.org/v1/gonum v0.12.0
5555
google.golang.org/grpc v1.59.0
5656
google.golang.org/protobuf v1.31.0
@@ -126,7 +126,7 @@ require (
126126
github.com/go-critic/go-critic v0.7.0 // indirect
127127
github.com/go-git/gcfg v1.5.0 // indirect
128128
github.com/go-git/go-billy/v5 v5.4.1 // indirect
129-
github.com/go-logr/logr v1.2.4 // indirect
129+
github.com/go-logr/logr v1.4.1 // indirect
130130
github.com/go-logr/stdr v1.2.2 // indirect
131131
github.com/go-toolsmith/astcast v1.1.0 // indirect
132132
github.com/go-toolsmith/astcopy v1.1.0 // indirect
@@ -151,7 +151,7 @@ require (
151151
github.com/golangci/revgrep v0.0.0-20220804021717-745bb2f7c2e6 // indirect
152152
github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4 // indirect
153153
github.com/google/btree v1.1.2 // indirect
154-
github.com/google/go-cmp v0.5.9 // indirect
154+
github.com/google/go-cmp v0.6.0 // indirect
155155
github.com/google/go-containerregistry v0.13.0 // indirect
156156
github.com/google/pprof v0.0.0-20230228050547-1710fef4ab10 // indirect
157157
github.com/gordonklaus/ineffassign v0.0.0-20230107090616-13ace0543b28 // indirect
@@ -160,6 +160,7 @@ require (
160160
github.com/gostaticanalysis/forcetypeassert v0.1.0 // indirect
161161
github.com/gostaticanalysis/nilerr v0.1.1 // indirect
162162
github.com/gotestyourself/gotestyourself v2.2.0+incompatible // indirect
163+
github.com/grafana/pyroscope-go/godeltaprof v0.1.6 // indirect
163164
github.com/gtank/ristretto255 v0.1.2 // indirect
164165
github.com/hashicorp/errwrap v1.1.0 // indirect
165166
github.com/hashicorp/go-multierror v1.1.1 // indirect
@@ -183,7 +184,7 @@ require (
183184
github.com/kisielk/errcheck v1.6.3 // indirect
184185
github.com/kisielk/gotool v1.0.0 // indirect
185186
github.com/kkHAIKE/contextcheck v1.1.4 // indirect
186-
github.com/klauspost/compress v1.16.0 // indirect
187+
github.com/klauspost/compress v1.17.3 // indirect
187188
github.com/klauspost/pgzip v1.2.5 // indirect
188189
github.com/kulti/thelper v0.6.3 // indirect
189190
github.com/kunwardeep/paralleltest v1.0.6 // indirect
@@ -227,7 +228,6 @@ require (
227228
github.com/prometheus/client_model v0.3.0 // indirect
228229
github.com/prometheus/common v0.42.0 // indirect
229230
github.com/prometheus/procfs v0.8.0 // indirect
230-
github.com/pyroscope-io/godeltaprof v0.1.2 // indirect
231231
github.com/quasilyte/go-ruleguard v0.3.19 // indirect
232232
github.com/quasilyte/gogrep v0.5.0 // indirect
233233
github.com/quasilyte/regex/syntax v0.0.0-20210819130434-b3f0c404a727 // indirect
@@ -274,17 +274,18 @@ require (
274274
github.com/yeya24/promlinter v0.2.0 // indirect
275275
gitlab.com/bosi/decorder v0.2.3 // indirect
276276
go.etcd.io/bbolt v1.3.6 // indirect
277-
go.opentelemetry.io/otel/trace v1.15.1 // indirect
277+
go.opentelemetry.io/otel/metric v1.24.0 // indirect
278+
go.opentelemetry.io/otel/trace v1.24.0 // indirect
278279
go.uber.org/atomic v1.10.0 // indirect
279280
go.uber.org/multierr v1.10.0 // indirect
280281
go.uber.org/zap v1.24.0 // indirect
281282
golang.org/x/exp v0.0.0-20230811145659-89c5cff77bcb // indirect
282283
golang.org/x/exp/typeparams v0.0.0-20230224173230-c95f2b4c22f2 // indirect
283284
golang.org/x/mod v0.11.0 // indirect
284285
golang.org/x/sync v0.3.0 // indirect
285-
golang.org/x/sys v0.13.0 // indirect
286-
golang.org/x/term v0.13.0 // indirect
287-
golang.org/x/text v0.13.0 // indirect
286+
golang.org/x/sys v0.17.0 // indirect
287+
golang.org/x/term v0.15.0 // indirect
288+
golang.org/x/text v0.14.0 // indirect
288289
golang.org/x/tools v0.7.0 // indirect
289290
google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect
290291
gopkg.in/ini.v1 v1.67.0 // indirect

‎go.sum

+72-33
Large diffs are not rendered by default.

‎node/node.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ import (
1111
"time"
1212

1313
dbm "github.com/cometbft/cometbft-db"
14+
"github.com/grafana/pyroscope-go"
1415
"github.com/prometheus/client_golang/prometheus"
1516
"github.com/prometheus/client_golang/prometheus/promhttp"
16-
"github.com/pyroscope-io/client/pyroscope"
1717
"github.com/rs/cors"
1818
sdktrace "go.opentelemetry.io/otel/sdk/trace"
1919

‎node/tracing.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
package node
22

33
import (
4-
"github.com/pyroscope-io/client/pyroscope"
4+
"github.com/grafana/pyroscope-go"
55
"github.com/tendermint/tendermint/config"
66

7-
otelpyroscope "github.com/pyroscope-io/otel-profiling-go"
7+
otelpyroscope "github.com/grafana/otel-profiling-go"
88
"go.opentelemetry.io/otel"
99
"go.opentelemetry.io/otel/exporters/stdout/stdouttrace"
1010
"go.opentelemetry.io/otel/propagation"

‎p2p/upnp/upnp.go

+1
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,7 @@ type statusInfo struct {
299299
}
300300

301301
func (n *upnpNAT) getExternalIPAddress() (info statusInfo, err error) {
302+
//nolint:goconst
302303
message := "<u:GetExternalIPAddress xmlns:u=\"urn:" + n.urnDomain + ":service:WANIPConnection:1\">\r\n" +
303304
"</u:GetExternalIPAddress>"
304305

‎rpc/core/events.go

-3
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,6 @@ func Subscribe(ctx *rpctypes.Context, query string) (*ctypes.ResultSubscribe, er
4646
if err != nil {
4747
return nil, err
4848
}
49-
if sub == nil {
50-
return nil, fmt.Errorf("env.EventBus.Subscribe() returned nil")
51-
}
5249

5350
closeIfSlow := env.Config.CloseOnSlowClient
5451

‎scripts/proto-gen.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ cd "$(git rev-parse --show-toplevel)"
1010

1111
# Run inside Docker to install the correct versions of the required tools
1212
# without polluting the local system.
13-
docker run --rm -i -v "$PWD":/w --workdir=/w golang:1.19-alpine sh <<"EOF"
13+
docker run --rm -i -v "$PWD":/w --workdir=/w golang:1.22-alpine sh <<"EOF"
1414
apk add git make
1515
1616
go install github.com/bufbuild/buf/cmd/buf

‎state/indexer/sink/psql/psql.go

+14-8
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,18 @@ func insertEvents(dbtx *sql.Tx, blockID, txID uint32, evts []abci.Event) error {
9090
txIDArg = txID
9191
}
9292

93+
const (
94+
insertEventQuery = `
95+
INSERT INTO ` + tableEvents + ` (block_id, tx_id, type)
96+
VALUES ($1, $2, $3)
97+
RETURNING rowid;
98+
`
99+
insertAttributeQuery = `
100+
INSERT INTO ` + tableAttributes + ` (event_id, key, composite_key, value)
101+
VALUES ($1, $2, $3, $4);
102+
`
103+
)
104+
93105
// Add each event to the events table, and retrieve its row ID to use when
94106
// adding any attributes the event provides.
95107
for _, evt := range evts {
@@ -98,10 +110,7 @@ func insertEvents(dbtx *sql.Tx, blockID, txID uint32, evts []abci.Event) error {
98110
continue
99111
}
100112

101-
eid, err := queryWithID(dbtx, `
102-
INSERT INTO `+tableEvents+` (block_id, tx_id, type) VALUES ($1, $2, $3)
103-
RETURNING rowid;
104-
`, blockID, txIDArg, evt.Type)
113+
eid, err := queryWithID(dbtx, insertEventQuery, blockID, txIDArg, evt.Type)
105114
if err != nil {
106115
return err
107116
}
@@ -112,10 +121,7 @@ INSERT INTO `+tableEvents+` (block_id, tx_id, type) VALUES ($1, $2, $3)
112121
continue
113122
}
114123
compositeKey := evt.Type + "." + string(attr.Key)
115-
if _, err := dbtx.Exec(`
116-
INSERT INTO `+tableAttributes+` (event_id, key, composite_key, value)
117-
VALUES ($1, $2, $3, $4);
118-
`, eid, attr.Key, compositeKey, attr.Value); err != nil {
124+
if _, err := dbtx.Exec(insertAttributeQuery, eid, attr.Key, compositeKey, attr.Value); err != nil {
119125
return err
120126
}
121127
}

‎test/docker/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.19
1+
FROM golang:1.22
22

33
# Grab deps (jq, hexdump, xxd, killall)
44
RUN apt-get update && \

‎test/e2e/docker/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# We need to build in a Linux environment to support C libraries, e.g. RocksDB.
22
# We use Debian instead of Alpine, so that we can use binary database packages
33
# instead of spending time compiling them.
4-
FROM golang:1.20-bullseye
4+
FROM golang:1.22-bullseye
55

66
RUN apt-get -qq update -y && apt-get -qq upgrade -y >/dev/null
77
RUN apt-get -qq install -y libleveldb-dev librocksdb-dev >/dev/null

0 commit comments

Comments
 (0)
Please sign in to comment.