Skip to content

Commit

Permalink
build: use go1.23.6 (#3767)
Browse files Browse the repository at this point in the history
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 #3033.
  • Loading branch information
thehowl authored Feb 20, 2025
1 parent 0fb25b5 commit b04ca6c
Show file tree
Hide file tree
Showing 25 changed files with 54 additions and 72 deletions.
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/BUG-REPORT.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Describe your issue in as much detail as possible here

### Your environment

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

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

### Proposed solution

If you have an idea of how to fix this issue, please write it down here, so we can begin discussing it
If you have an idea of how to fix this issue, please write it down here, so we can begin discussing it
2 changes: 1 addition & 1 deletion .github/workflows/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ jobs:
strategy:
fail-fast: false
matrix:
go-version: [ "1.23.x" ]
go-version: ["1.23.x"]
# unittests: TODO: matrix with contracts
runs-on: ubuntu-latest
timeout-minutes: 10
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gnofmt_template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ jobs:

- name: Check for unformatted code
run: |
git diff --exit-code || (echo "Some gno files are not formatted, please run 'make fmt'." && exit 1)
git diff --exit-code || (echo "Some gno files are not formatted, please run 'make fmt'." && exit 1)
1 change: 0 additions & 1 deletion .github/workflows/main_template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,3 @@ jobs:
tests-extra-args: ${{ inputs.tests-extra-args }}
secrets:
codecov-token: ${{ secrets.codecov-token }}

3 changes: 1 addition & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ The gno repository is primarily based on Go (Golang) and Gno.

The primary tech stack for working on the repository:

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

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

4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# build gno
FROM golang:1.22-alpine AS build-gno
FROM golang:1.23-alpine AS build-gno
RUN go env -w GOMODCACHE=/root/.cache/go-build
WORKDIR /gnoroot
ENV GNOROOT="/gnoroot"
Expand All @@ -11,7 +11,7 @@ RUN --mount=type=cache,target=/root/.cache/go-build go build -o ./
RUN --mount=type=cache,target=/root/.cache/go-build go build -o ./build/gno ./gnovm/cmd/gno

# build misc binaries
FROM golang:1.22-alpine AS build-misc
FROM golang:1.23-alpine AS build-misc
RUN go env -w GOMODCACHE=/root/.cache/go-build
WORKDIR /gnoroot
ENV GNOROOT="/gnoroot"
Expand Down
4 changes: 1 addition & 3 deletions contribs/github-bot/go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
module github.com/gnolang/gno/contribs/github-bot

go 1.22.0

toolchain go1.23.2
go 1.23.6

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

Expand Down
4 changes: 1 addition & 3 deletions contribs/gnodev/go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
module github.com/gnolang/gno/contribs/gnodev

go 1.22.0

toolchain go1.22.10
go 1.23.6

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

Expand Down
4 changes: 1 addition & 3 deletions contribs/gnofaucet/go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
module github.com/gnolang/gno/contribs/gnofaucet

go 1.22.0

toolchain go1.22.10
go 1.23.6

require (
github.com/gnolang/faucet v0.3.2
Expand Down
4 changes: 1 addition & 3 deletions contribs/gnogenesis/go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
module github.com/gnolang/contribs/gnogenesis

go 1.22.0

toolchain go1.22.10
go 1.23.6

require (
github.com/gnolang/gno v0.0.0-00010101000000-000000000000
Expand Down
2 changes: 1 addition & 1 deletion contribs/gnohealth/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/gnolang/gno/contribs/gnohealth

go 1.22.4
go 1.23.6

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

Expand Down
4 changes: 1 addition & 3 deletions contribs/gnokeykc/go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
module github.com/gnolang/gno/contribs/gnokeykc

go 1.22.0

toolchain go1.22.10
go 1.23.6

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

Expand Down
4 changes: 1 addition & 3 deletions contribs/gnomigrate/go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
module github.com/gnolang/gnomigrate

go 1.22.0

toolchain go1.22.10
go 1.23.6

require (
github.com/gnolang/gno v0.0.0-00010101000000-000000000000
Expand Down
2 changes: 1 addition & 1 deletion docs/getting-started/local-setup/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ to run on your machine.
## Prerequisites
- **Git**
- **`make` (for running Makefiles)**
- **Go 1.22+**
- **Go 1.23+**
- **Go Environment Setup**:
- Make sure `$GOPATH` is well-defined, and `$GOPATH/bin` is added to your `$PATH` variable.
- To do this, you can add the following line to your `.bashrc`, `.zshrc` or other config file:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ In this tutorial, you will learn how to start a local Gno node and connect to an

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Additionally, you will see the different options you can use to make your Gno in

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

Expand Down
2 changes: 1 addition & 1 deletion gnovm/cmd/gno/bug.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func newBugCmd(io commands.IO) *commands.Command {
The new issue body is prefilled for you with the following information:
- Gno version (the output of "gno version")
- Go version (example: go1.22.4)
- Go version (example: go1.23.4)
- OS and CPU architecture (example: linux/amd64)
- Gno commit hash causing the issue (example: f24690e7ebf325bffcfaf9e328c3df8e6b21e50c)
Expand Down
25 changes: 16 additions & 9 deletions gnovm/pkg/gnolang/internal/txlog/txlog.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
// when calling [MapCommitter.Commit].
package txlog

import "iter"

// Map is a generic interface to a key/value map, like Go's builtin map.
type Map[K comparable, V any] interface {
Get(K) (V, bool)
Set(K, V)
Delete(K)
Iterate() func(yield func(K, V) bool)
Iterate() iter.Seq2[K, V]
}

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

// Iterate implements [Map].
func (m GoMap[K, V]) Iterate() func(yield func(K, V) bool) {
func (m GoMap[K, V]) Iterate() iter.Seq2[K, V] {
return func(yield func(K, V) bool) {
for k, v := range m {
if !yield(k, v) {
Expand Down Expand Up @@ -103,21 +105,26 @@ func (b txLog[K, V]) Delete(k K) {
b.dirty[k] = deletable[V]{deleted: true}
}

func (b txLog[K, V]) Iterate() func(yield func(K, V) bool) {
func (b txLog[K, V]) Iterate() iter.Seq2[K, V] {
return func(yield func(K, V) bool) {
// go through b.source; skip deleted values, and use updated values
// for those which exist in b.dirty.
b.source.Iterate()(func(k K, v V) bool {
for k, v := range b.source.Iterate() {
if dirty, ok := b.dirty[k]; ok {
if dirty.deleted {
return true
continue
}
if !yield(k, dirty.v) {
return
}
return yield(k, dirty.v)
continue
}

// not in dirty
return yield(k, v)
})
if !yield(k, v) {
return
}
}

// iterate over all "new" values (ie. exist in b.dirty but not b.source).
for k, v := range b.dirty {
Expand All @@ -129,7 +136,7 @@ func (b txLog[K, V]) Iterate() func(yield func(K, V) bool) {
continue
}
if !yield(k, v.v) {
break
return
}
}
}
Expand Down
21 changes: 10 additions & 11 deletions gnovm/pkg/gnolang/internal/txlog/txlog_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,17 @@ func ExampleWrap() {
func Test_txLog(t *testing.T) {
t.Parallel()

type Value = struct{}
type Value = struct{ b byte }

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

// create 4 empty values (we'll just use the pointers)
vs := [...]*Value{
{},
{},
{},
{},
{0},
{1},
{2},
{3},
}
source.Set(0, vs[0])
source.Set(1, vs[1])
Expand Down Expand Up @@ -121,8 +121,8 @@ func Test_txLog(t *testing.T) {
assert.Equal(t, saved, txm.source)

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

{
Expand All @@ -146,17 +146,16 @@ func Test_txLog(t *testing.T) {
}
}

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

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

Expand Down
10 changes: 4 additions & 6 deletions gnovm/pkg/gnolang/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,14 +246,12 @@ func CopyFromCachedStore(destStore, cachedStore Store, cachedBase, cachedIavl st
ds.iavlStore.Set(iter.Key(), iter.Value())
}

ss.cacheTypes.Iterate()(func(k TypeID, v Type) bool {
for k, v := range ss.cacheTypes.Iterate() {
ds.cacheTypes.Set(k, v)
return true
})
ss.cacheNodes.Iterate()(func(k Location, v BlockNode) bool {
}
for k, v := range ss.cacheNodes.Iterate() {
ds.cacheNodes.Set(k, v)
return true
})
}
}

func (ds *defaultStore) GetAllocator() *Allocator {
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module github.com/gnolang/gno

go 1.22.0
go 1.23

toolchain go1.22.10
toolchain go1.23.6

require (
dario.cat/mergo v1.0.1
Expand Down
4 changes: 1 addition & 3 deletions misc/autocounterd/go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
module autocounterd

go 1.22.0

toolchain go1.22.10
go 1.23.6

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

Expand Down
4 changes: 1 addition & 3 deletions misc/docs-linter/go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
module linter

go 1.22.0

toolchain go1.23.2
go 1.23.6

require (
github.com/gnolang/gno v0.0.0-00010101000000-000000000000
Expand Down
4 changes: 1 addition & 3 deletions misc/loop/go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
module loop

go 1.22.0

toolchain go1.22.10
go 1.23.6

require (
github.com/docker/docker v25.0.6+incompatible
Expand Down
4 changes: 1 addition & 3 deletions misc/stdlib_diff/go.mod
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
module github.com/gnolang/gno/misc/stdlib_diff

go 1.22.0

toolchain go1.22.10
go 1.23.6

require github.com/hexops/gotextdiff v1.0.3

0 comments on commit b04ca6c

Please sign in to comment.