Skip to content

Commit b04ca6c

Browse files
authored
build: use go1.23.6 (gnolang#3767)
Seeing as Go is now at version 1.24, making this PR to bump to the latest patch version of 1.23. This will also fix the CI on master. Changes aside from go.mod concern updating a few methods in `txlog` which were always intended to use 1.23 iterators, but couldn't until now. There is a language change (the aforementioned range funcs), but it shouldn't impact existing code. Pinging those who I think could verify this in the reviewers. Fixes gnolang#3033.
1 parent 0fb25b5 commit b04ca6c

File tree

25 files changed

+54
-72
lines changed

25 files changed

+54
-72
lines changed

.github/ISSUE_TEMPLATE/BUG-REPORT.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Describe your issue in as much detail as possible here
1313

1414
### Your environment
1515

16-
* Go version (example: go1.23.4)
16+
* Go version (example: go1.23.6)
1717
* OS and CPU architecture (example: linux/amd64)
1818
* Gno commit hash causing the issue (example: f24690e7ebf325bffcfaf9e328c3df8e6b21e50c)
1919

@@ -37,4 +37,4 @@ Please paste any logs here that demonstrate the issue, if they exist
3737

3838
### Proposed solution
3939

40-
If you have an idea of how to fix this issue, please write it down here, so we can begin discussing it
40+
If you have an idea of how to fix this issue, please write it down here, so we can begin discussing it

.github/workflows/examples.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ jobs:
8989
strategy:
9090
fail-fast: false
9191
matrix:
92-
go-version: [ "1.23.x" ]
92+
go-version: ["1.23.x"]
9393
# unittests: TODO: matrix with contracts
9494
runs-on: ubuntu-latest
9595
timeout-minutes: 10

.github/workflows/gnofmt_template.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ jobs:
3030

3131
- name: Check for unformatted code
3232
run: |
33-
git diff --exit-code || (echo "Some gno files are not formatted, please run 'make fmt'." && exit 1)
33+
git diff --exit-code || (echo "Some gno files are not formatted, please run 'make fmt'." && exit 1)

.github/workflows/main_template.yml

-1
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,3 @@ jobs:
3939
tests-extra-args: ${{ inputs.tests-extra-args }}
4040
secrets:
4141
codecov-token: ${{ secrets.codecov-token }}
42-

CONTRIBUTING.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ The gno repository is primarily based on Go (Golang) and Gno.
5656

5757
The primary tech stack for working on the repository:
5858

59-
- Go (version 1.22+)
59+
- Go (version 1.23+)
6060
- make (for using Makefile configurations)
6161

6262
It is recommended to work on a Unix environment, as most of the tooling is built around ready-made tools in Unix (WSL2
@@ -514,4 +514,3 @@ automatic label management.
514514
| info needed | Issue is lacking information needed for resolving |
515515
| investigating | Issue is still being investigated by the team |
516516
| question | Issue starts a discussion or raises a question |
517-

Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# build gno
2-
FROM golang:1.22-alpine AS build-gno
2+
FROM golang:1.23-alpine AS build-gno
33
RUN go env -w GOMODCACHE=/root/.cache/go-build
44
WORKDIR /gnoroot
55
ENV GNOROOT="/gnoroot"
@@ -11,7 +11,7 @@ RUN --mount=type=cache,target=/root/.cache/go-build go build -o ./
1111
RUN --mount=type=cache,target=/root/.cache/go-build go build -o ./build/gno ./gnovm/cmd/gno
1212

1313
# build misc binaries
14-
FROM golang:1.22-alpine AS build-misc
14+
FROM golang:1.23-alpine AS build-misc
1515
RUN go env -w GOMODCACHE=/root/.cache/go-build
1616
WORKDIR /gnoroot
1717
ENV GNOROOT="/gnoroot"

contribs/github-bot/go.mod

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
module github.com/gnolang/gno/contribs/github-bot
22

3-
go 1.22.0
4-
5-
toolchain go1.23.2
3+
go 1.23.6
64

75
replace github.com/gnolang/gno => ../..
86

contribs/gnodev/go.mod

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
module github.com/gnolang/gno/contribs/gnodev
22

3-
go 1.22.0
4-
5-
toolchain go1.22.10
3+
go 1.23.6
64

75
replace github.com/gnolang/gno => ../..
86

contribs/gnofaucet/go.mod

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
module github.com/gnolang/gno/contribs/gnofaucet
22

3-
go 1.22.0
4-
5-
toolchain go1.22.10
3+
go 1.23.6
64

75
require (
86
github.com/gnolang/faucet v0.3.2

contribs/gnogenesis/go.mod

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
module github.com/gnolang/contribs/gnogenesis
22

3-
go 1.22.0
4-
5-
toolchain go1.22.10
3+
go 1.23.6
64

75
require (
86
github.com/gnolang/gno v0.0.0-00010101000000-000000000000

contribs/gnohealth/go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/gnolang/gno/contribs/gnohealth
22

3-
go 1.22.4
3+
go 1.23.6
44

55
replace github.com/gnolang/gno => ../..
66

contribs/gnokeykc/go.mod

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
module github.com/gnolang/gno/contribs/gnokeykc
22

3-
go 1.22.0
4-
5-
toolchain go1.22.10
3+
go 1.23.6
64

75
replace github.com/gnolang/gno => ../..
86

contribs/gnomigrate/go.mod

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
module github.com/gnolang/gnomigrate
22

3-
go 1.22.0
4-
5-
toolchain go1.22.10
3+
go 1.23.6
64

75
require (
86
github.com/gnolang/gno v0.0.0-00010101000000-000000000000

docs/getting-started/local-setup/installation.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ to run on your machine.
1313
## Prerequisites
1414
- **Git**
1515
- **`make` (for running Makefiles)**
16-
- **Go 1.22+**
16+
- **Go 1.23+**
1717
- **Go Environment Setup**:
1818
- Make sure `$GOPATH` is well-defined, and `$GOPATH/bin` is added to your `$PATH` variable.
1919
- To do this, you can add the following line to your `.bashrc`, `.zshrc` or other config file:

docs/gno-infrastructure/validators/connect-to-existing-chain.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ In this tutorial, you will learn how to start a local Gno node and connect to an
1212

1313
- **Git**
1414
- **`make` (for running Makefiles)**
15-
- **Go 1.22+**
15+
- **Go 1.23+**
1616
- **Go Environment Setup**: Ensure you have Go set up as outlined in
1717
the [Go official installation documentation](https://go.dev/doc/install) for your environment
1818

docs/gno-infrastructure/validators/setting-up-a-new-chain.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Additionally, you will see the different options you can use to make your Gno in
1313

1414
- **Git**
1515
- **`make` (for running Makefiles)**
16-
- **Go 1.22+**
16+
- **Go 1.23+**
1717
- **Go Environment Setup**: Ensure you have Go set up as outlined in
1818
the [Go official installation documentation](https://go.dev/doc/install) for your environment
1919

gnovm/cmd/gno/bug.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ func newBugCmd(io commands.IO) *commands.Command {
6969
The new issue body is prefilled for you with the following information:
7070
7171
- Gno version (the output of "gno version")
72-
- Go version (example: go1.22.4)
72+
- Go version (example: go1.23.4)
7373
- OS and CPU architecture (example: linux/amd64)
7474
- Gno commit hash causing the issue (example: f24690e7ebf325bffcfaf9e328c3df8e6b21e50c)
7575

gnovm/pkg/gnolang/internal/txlog/txlog.go

+16-9
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@
77
// when calling [MapCommitter.Commit].
88
package txlog
99

10+
import "iter"
11+
1012
// Map is a generic interface to a key/value map, like Go's builtin map.
1113
type Map[K comparable, V any] interface {
1214
Get(K) (V, bool)
1315
Set(K, V)
1416
Delete(K)
15-
Iterate() func(yield func(K, V) bool)
17+
Iterate() iter.Seq2[K, V]
1618
}
1719

1820
// MapCommitter is a Map which also implements a Commit() method, which writes
@@ -47,7 +49,7 @@ func (m GoMap[K, V]) Delete(k K) {
4749
}
4850

4951
// Iterate implements [Map].
50-
func (m GoMap[K, V]) Iterate() func(yield func(K, V) bool) {
52+
func (m GoMap[K, V]) Iterate() iter.Seq2[K, V] {
5153
return func(yield func(K, V) bool) {
5254
for k, v := range m {
5355
if !yield(k, v) {
@@ -103,21 +105,26 @@ func (b txLog[K, V]) Delete(k K) {
103105
b.dirty[k] = deletable[V]{deleted: true}
104106
}
105107

106-
func (b txLog[K, V]) Iterate() func(yield func(K, V) bool) {
108+
func (b txLog[K, V]) Iterate() iter.Seq2[K, V] {
107109
return func(yield func(K, V) bool) {
108110
// go through b.source; skip deleted values, and use updated values
109111
// for those which exist in b.dirty.
110-
b.source.Iterate()(func(k K, v V) bool {
112+
for k, v := range b.source.Iterate() {
111113
if dirty, ok := b.dirty[k]; ok {
112114
if dirty.deleted {
113-
return true
115+
continue
116+
}
117+
if !yield(k, dirty.v) {
118+
return
114119
}
115-
return yield(k, dirty.v)
120+
continue
116121
}
117122

118123
// not in dirty
119-
return yield(k, v)
120-
})
124+
if !yield(k, v) {
125+
return
126+
}
127+
}
121128

122129
// iterate over all "new" values (ie. exist in b.dirty but not b.source).
123130
for k, v := range b.dirty {
@@ -129,7 +136,7 @@ func (b txLog[K, V]) Iterate() func(yield func(K, V) bool) {
129136
continue
130137
}
131138
if !yield(k, v.v) {
132-
break
139+
return
133140
}
134141
}
135142
}

gnovm/pkg/gnolang/internal/txlog/txlog_test.go

+10-11
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,17 @@ func ExampleWrap() {
5151
func Test_txLog(t *testing.T) {
5252
t.Parallel()
5353

54-
type Value = struct{}
54+
type Value = struct{ b byte }
5555

5656
// Full "integration test" of the txLog + mapwrapper.
5757
source := GoMap[int, *Value](map[int]*Value{})
5858

5959
// create 4 empty values (we'll just use the pointers)
6060
vs := [...]*Value{
61-
{},
62-
{},
63-
{},
64-
{},
61+
{0},
62+
{1},
63+
{2},
64+
{3},
6565
}
6666
source.Set(0, vs[0])
6767
source.Set(1, vs[1])
@@ -121,8 +121,8 @@ func Test_txLog(t *testing.T) {
121121
assert.Equal(t, saved, txm.source)
122122

123123
// double-check on the iterators.
124-
verifyHashMapValues(t, source, map[int]*Value{1: vs[1], 2: vs[0]})
125-
verifyHashMapValues(t, txm, map[int]*Value{2: vs[2], 3: vs[3]})
124+
verifyHashMapValues(t, source, map[int]*Value{1: vs[1], 2: vs[2]})
125+
verifyHashMapValues(t, txm, map[int]*Value{2: vs[0], 3: vs[3]})
126126
}
127127

128128
{
@@ -146,17 +146,16 @@ func Test_txLog(t *testing.T) {
146146
}
147147
}
148148

149-
func verifyHashMapValues(t *testing.T, m Map[int, *struct{}], expectedReadonly map[int]*struct{}) {
149+
func verifyHashMapValues(t *testing.T, m Map[int, *struct{ b byte }], expectedReadonly map[int]*struct{ b byte }) {
150150
t.Helper()
151151

152152
expected := maps.Clone(expectedReadonly)
153-
m.Iterate()(func(k int, v *struct{}) bool {
153+
for k, v := range m.Iterate() {
154154
ev, eok := expected[k]
155155
_ = assert.True(t, eok, "mapping %d:%v should exist in expected map", k, v) &&
156156
assert.Equal(t, ev, v, "values should match")
157157
delete(expected, k)
158-
return true
159-
})
158+
}
160159
assert.Empty(t, expected, "(some) expected values not found in the Map")
161160
}
162161

gnovm/pkg/gnolang/store.go

+4-6
Original file line numberDiff line numberDiff line change
@@ -246,14 +246,12 @@ func CopyFromCachedStore(destStore, cachedStore Store, cachedBase, cachedIavl st
246246
ds.iavlStore.Set(iter.Key(), iter.Value())
247247
}
248248

249-
ss.cacheTypes.Iterate()(func(k TypeID, v Type) bool {
249+
for k, v := range ss.cacheTypes.Iterate() {
250250
ds.cacheTypes.Set(k, v)
251-
return true
252-
})
253-
ss.cacheNodes.Iterate()(func(k Location, v BlockNode) bool {
251+
}
252+
for k, v := range ss.cacheNodes.Iterate() {
254253
ds.cacheNodes.Set(k, v)
255-
return true
256-
})
254+
}
257255
}
258256

259257
func (ds *defaultStore) GetAllocator() *Allocator {

go.mod

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
module github.com/gnolang/gno
22

3-
go 1.22.0
3+
go 1.23
44

5-
toolchain go1.22.10
5+
toolchain go1.23.6
66

77
require (
88
dario.cat/mergo v1.0.1

misc/autocounterd/go.mod

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
module autocounterd
22

3-
go 1.22.0
4-
5-
toolchain go1.22.10
3+
go 1.23.6
64

75
require github.com/gnolang/gno v0.0.0-00010101000000-000000000000
86

misc/docs-linter/go.mod

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
module linter
22

3-
go 1.22.0
4-
5-
toolchain go1.23.2
3+
go 1.23.6
64

75
require (
86
github.com/gnolang/gno v0.0.0-00010101000000-000000000000

misc/loop/go.mod

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
module loop
22

3-
go 1.22.0
4-
5-
toolchain go1.22.10
3+
go 1.23.6
64

75
require (
86
github.com/docker/docker v25.0.6+incompatible

misc/stdlib_diff/go.mod

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
module github.com/gnolang/gno/misc/stdlib_diff
22

3-
go 1.22.0
4-
5-
toolchain go1.22.10
3+
go 1.23.6
64

75
require github.com/hexops/gotextdiff v1.0.3

0 commit comments

Comments
 (0)