Skip to content

Commit

Permalink
build(deps): bump to go 1.24 (#4509)
Browse files Browse the repository at this point in the history
* build(deps): bump to go 1.24

* revert 7066f56

* revert 5bbc1a1

* fixes

* updates

* bump chain

* doctor quick fix

* updates

* updates

* use go tool

* fix vuln

* updates

* use go tool

* updates

* cl

* lint

* use buf from go tool

* updates

* typo

* updates

* use go tool for buf

* fix lint + run go tools

* updates

* updates

* simplify
  • Loading branch information
julienrbrt authored Mar 8, 2025
1 parent ffc8e64 commit 6a6412a
Show file tree
Hide file tree
Showing 46 changed files with 496 additions and 873 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test-cov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:

- uses: actions/setup-go@v5
with:
go-version: "1.23.6"
go-version: "stable"

- run: ./scripts/test-coverage

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:

- uses: actions/setup-go@v5
with:
go-version: "1.23.6"
go-version: "stable"

- name: Run Integration Tests
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ jobs:

- uses: actions/setup-go@v5
with:
go-version: "1.23.6"
go-version: "stable"

- run: ./scripts/test
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

## prep the base image.
#
FROM golang:1.23.6 as base
FROM golang as base

RUN apt update && \
apt-get install -y \
Expand Down
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,23 +47,23 @@ govet:
## govulncheck: Run govulncheck
govulncheck:
@echo Running govulncheck...
@go run golang.org/x/vuln/cmd/govulncheck ./...
@go tool golang.org/x/vuln/cmd/govulncheck ./...

## format: Install and run goimports and gofumpt
format:
@echo Formatting...
@go run mvdan.cc/gofumpt -w .
@go run golang.org/x/tools/cmd/goimports -w -local github.com/ignite/cli/v29 .
@go run github.com/tbruyelle/mdgofmt/cmd/mdgofmt -w docs
@go tool mvdan.cc/gofumpt -w .
@go tool golang.org/x/tools/cmd/goimports -w -local github.com/ignite/cli/v29 .
@go tool github.com/tbruyelle/mdgofmt/cmd/mdgofmt -w docs

## lint: Run Golang CI Lint.
lint:
@echo Running golangci-lint...
@go run github.com/golangci/golangci-lint/cmd/golangci-lint run --out-format=tab --issues-exit-code=0
@go tool github.com/golangci/golangci-lint/cmd/golangci-lint run --out-format=tab --issues-exit-code=0

lint-fix:
@echo Running golangci-lint...
@go run github.com/golangci/golangci-lint/cmd/golangci-lint run --fix --out-format=tab --issues-exit-code=0
@go tool github.com/golangci/golangci-lint/cmd/golangci-lint run --fix --out-format=tab --issues-exit-code=0

.PHONY: govet format lint

Expand Down
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### Features

- [#4509](https://github.com/ignite/cli/pull/4509) Upgrade to Go 1.24. Running `ignite doctor` migrates the scaffolded `tools.go` to the tool directive in the go.mod

## [`v29.0.0-beta.1`](https://github.com/ignite/cli/releases/tag/v29.0.0-beta.1)

### Features
Expand Down
30 changes: 20 additions & 10 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/ignite/cli/v29

go 1.23.6
go 1.24.0

require (
cosmossdk.io/math v1.5.0
Expand All @@ -10,7 +10,6 @@ require (
github.com/DATA-DOG/go-sqlmock v1.5.2
github.com/blang/semver/v4 v4.0.0
github.com/briandowns/spinner v1.23.2
github.com/bufbuild/buf v1.50.0
github.com/buger/jsonparser v1.1.1
github.com/cenkalti/backoff v2.2.1+incompatible
github.com/charmbracelet/bubbles v0.20.0
Expand All @@ -35,7 +34,6 @@ require (
github.com/gobuffalo/plush/v4 v4.1.22
github.com/gobwas/glob v0.2.3
github.com/goccy/go-yaml v1.15.23
github.com/golangci/golangci-lint v1.64.5
github.com/google/go-github/v48 v48.2.0
github.com/google/go-querystring v1.1.0
github.com/gookit/color v1.5.4
Expand All @@ -56,19 +54,14 @@ require (
github.com/spf13/cobra v1.9.1
github.com/spf13/pflag v1.0.6
github.com/stretchr/testify v1.10.0
github.com/tbruyelle/mdgofmt v0.1.3
github.com/vektra/mockery/v2 v2.46.0
go.etcd.io/bbolt v1.4.0
golang.org/x/mod v0.23.0
golang.org/x/mod v0.24.0
golang.org/x/sync v0.11.0
golang.org/x/term v0.29.0
golang.org/x/text v0.22.0
golang.org/x/tools v0.30.0
golang.org/x/vuln v1.1.4
google.golang.org/grpc v1.70.0
google.golang.org/protobuf v1.36.4
gopkg.in/yaml.v3 v3.0.1
mvdan.cc/gofumpt v0.7.0
sigs.k8s.io/yaml v1.4.0
)

Expand Down Expand Up @@ -133,6 +126,7 @@ require (
github.com/bombsimon/wsl/v4 v4.5.0 // indirect
github.com/breml/bidichk v0.3.2 // indirect
github.com/breml/errchkjson v0.4.0 // indirect
github.com/bufbuild/buf v1.50.0 // indirect
github.com/bufbuild/protocompile v0.14.1 // indirect
github.com/bufbuild/protoplugin v0.0.0-20250106231243-3a819552c9d9 // indirect
github.com/bufbuild/protovalidate-go v0.8.2 // indirect
Expand Down Expand Up @@ -258,6 +252,7 @@ require (
github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a // indirect
github.com/golangci/go-printf-func-name v0.1.0 // indirect
github.com/golangci/gofmt v0.0.0-20250106114630-d62b90e6713d // indirect
github.com/golangci/golangci-lint v1.64.5 // indirect
github.com/golangci/misspell v0.6.0 // indirect
github.com/golangci/plugin-module-register v0.1.1 // indirect
github.com/golangci/revgrep v0.8.0 // indirect
Expand Down Expand Up @@ -433,6 +428,7 @@ require (
github.com/stretchr/objx v0.5.2 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect
github.com/tbruyelle/mdgofmt v0.1.3 // indirect
github.com/tdakkota/asciicheck v0.4.0 // indirect
github.com/tendermint/go-amino v0.16.0 // indirect
github.com/tetafro/godot v1.4.20 // indirect
Expand All @@ -447,6 +443,7 @@ require (
github.com/uudashr/gocognit v1.2.0 // indirect
github.com/uudashr/iface v1.3.1 // indirect
github.com/vbatts/tar-split v0.11.6 // indirect
github.com/vektra/mockery/v2 v2.46.0 // indirect
github.com/xanzy/ssh-agent v0.3.3 // indirect
github.com/xen0n/gosmopolitan v1.2.2 // indirect
github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778 // indirect
Expand Down Expand Up @@ -478,12 +475,14 @@ require (
go.uber.org/zap v1.27.0 // indirect
go.uber.org/zap/exp v0.3.0 // indirect
golang.org/x/arch v0.11.0 // indirect
golang.org/x/crypto v0.33.0 // indirect
golang.org/x/crypto v0.35.0 // indirect
golang.org/x/exp v0.0.0-20250106191152-7588d65b2ba8 // indirect
golang.org/x/exp/typeparams v0.0.0-20250210185358-939b2ce775ac // indirect
golang.org/x/net v0.35.0 // indirect
golang.org/x/sys v0.30.0 // indirect
golang.org/x/telemetry v0.0.0-20241106142447-58a1122356f5 // indirect
golang.org/x/tools v0.30.0 // indirect
golang.org/x/vuln v1.1.4 // indirect
google.golang.org/genproto v0.0.0-20241118233622-e639e219e697 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20250106144421-5f5ef82da422 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250127172529-29210b9bc287 // indirect
Expand All @@ -492,12 +491,23 @@ require (
gopkg.in/yaml.v2 v2.4.0 // indirect
gotest.tools/v3 v3.5.1 // indirect
honnef.co/go/tools v0.6.0 // indirect
mvdan.cc/gofumpt v0.7.0 // indirect
mvdan.cc/unparam v0.0.0-20240528143540-8a5130ca722f // indirect
nhooyr.io/websocket v1.8.6 // indirect
pgregory.net/rapid v1.1.0 // indirect
pluginrpc.com/pluginrpc v0.5.0 // indirect
)

tool (
github.com/bufbuild/buf/cmd/buf
github.com/golangci/golangci-lint/cmd/golangci-lint
github.com/tbruyelle/mdgofmt/cmd/mdgofmt
github.com/vektra/mockery/v2
golang.org/x/tools/cmd/goimports
golang.org/x/vuln/cmd/govulncheck
mvdan.cc/gofumpt
)

replace (
github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0
github.com/dgrijalva/jwt-go => github.com/golang-jwt/jwt/v4 v4.4.2
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1877,8 +1877,8 @@ golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e/go.mod h1:IxCIyHEi3zRg3s0
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc=
golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4=
golang.org/x/crypto v0.33.0 h1:IOBPskki6Lysi0lo9qQvbxiQ+FvsCC/YWOecCHAixus=
golang.org/x/crypto v0.33.0/go.mod h1:bVdXmD7IV/4GdElGPozy6U7lWdRXA4qyRVGJV57uQ5M=
golang.org/x/crypto v0.35.0 h1:b15kiHdrGCHrP6LvwaQ3c03kgNhhiMgvlhxHQhmg2Xs=
golang.org/x/crypto v0.35.0/go.mod h1:dy7dXNW32cAb/6/PRuTNsix8T+vJAqvuIy5Bli/x0YQ=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
Expand Down Expand Up @@ -1928,8 +1928,8 @@ golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.13.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/mod v0.23.0 h1:Zb7khfcRGKk+kqfxFaP5tZqCnDZMjC5VtUBs87Hr6QM=
golang.org/x/mod v0.23.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
golang.org/x/mod v0.24.0 h1:ZfthKaKaT4NrhGVZHO1/WDTwGES4De8KtWO0SIbNJMU=
golang.org/x/mod v0.24.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
Expand Down
24 changes: 12 additions & 12 deletions ignite/cmd/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

"github.com/manifoldco/promptui"
"github.com/spf13/cobra"
"golang.org/x/mod/modfile"

chainconfig "github.com/ignite/cli/v29/ignite/config/chain"
"github.com/ignite/cli/v29/ignite/pkg/cliui"
Expand All @@ -17,10 +18,8 @@ import (
"github.com/ignite/cli/v29/ignite/pkg/cosmosgen"
"github.com/ignite/cli/v29/ignite/pkg/errors"
"github.com/ignite/cli/v29/ignite/pkg/goanalysis"
"github.com/ignite/cli/v29/ignite/pkg/xast"
"github.com/ignite/cli/v29/ignite/pkg/xgenny"
"github.com/ignite/cli/v29/ignite/services/chain"
"github.com/ignite/cli/v29/ignite/services/doctor"
)

const (
Expand Down Expand Up @@ -140,14 +139,15 @@ func preRunHandler(cmd *cobra.Command, _ []string) error {
func toolsMigrationPreRunHandler(cmd *cobra.Command, session *cliui.Session, appPath string) error {
session.StartSpinner("Checking missing tools...")

toolsFilename := filepath.Join(appPath, doctor.ToolsFile)
if _, err := os.Stat(toolsFilename); os.IsNotExist(err) {
return errors.New("the dependency tools file is missing, run `ignite doctor` and try again")
goModPath := filepath.Join(appPath, "go.mod")
data, err := os.ReadFile(goModPath)
if err != nil {
return errors.Errorf("failed to read go.mod file: %w", err)
}

f, _, err := xast.ParseFile(toolsFilename)
f, err := modfile.Parse(goModPath, data, nil)
if err != nil {
return err
return errors.Errorf("failed to parse go.mod file: %w", err)
}

missing := cosmosgen.MissingTools(f)
Expand All @@ -158,7 +158,7 @@ func toolsMigrationPreRunHandler(cmd *cobra.Command, session *cliui.Session, app
if len(missing) > 0 {
question := fmt.Sprintf(
msgMigrationAddTools,
toolsFilename,
goModPath,
strings.Join(missing, ", "),
)
if err := session.AskConfirm(question); err != nil {
Expand All @@ -169,7 +169,7 @@ func toolsMigrationPreRunHandler(cmd *cobra.Command, session *cliui.Session, app
if len(unused) > 0 {
question := fmt.Sprintf(
msgMigrationRemoveTools,
toolsFilename,
goModPath,
strings.Join(unused, ", "),
)
if err := session.AskConfirm(question); err != nil {
Expand All @@ -180,14 +180,14 @@ func toolsMigrationPreRunHandler(cmd *cobra.Command, session *cliui.Session, app
if len(missing) == 0 && len(unused) == 0 {
return nil
}
session.StartSpinner("Migrating tools...")

session.StartSpinner("Migrating tools...")
var buf bytes.Buffer
if err := goanalysis.UpdateInitImports(f, &buf, missing, unused); err != nil {
if err := goanalysis.AddOrRemoveTools(f, &buf, missing, unused); err != nil {
return err
}

return os.WriteFile(toolsFilename, buf.Bytes(), 0o600)
return os.WriteFile(goModPath, buf.Bytes(), 0o600)
}

func bufMigrationPreRunHandler(cmd *cobra.Command, session *cliui.Session, appPath, protoDir string) error {
Expand Down
6 changes: 5 additions & 1 deletion ignite/cmd/doctor.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,15 @@ func NewDoctor() *cobra.Command {
return err
}

if err := doc.MigrateToolsGo(appPath); err != nil {
return err
}

if err := doc.MigratePluginsConfig(); err != nil {
return err
}

return doc.FixDependencyTools(cmd.Context())
return nil
},
}

Expand Down
12 changes: 11 additions & 1 deletion ignite/cmd/scaffold.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/ignite/cli/v29/ignite/pkg/cliui"
"github.com/ignite/cli/v29/ignite/pkg/cosmosver"
"github.com/ignite/cli/v29/ignite/pkg/errors"
"github.com/ignite/cli/v29/ignite/pkg/gocmd"
"github.com/ignite/cli/v29/ignite/pkg/xgit"
"github.com/ignite/cli/v29/ignite/services/scaffolder"
"github.com/ignite/cli/v29/ignite/version"
Expand Down Expand Up @@ -164,7 +165,16 @@ func migrationPreRunHandler(cmd *cobra.Command, args []string) error {
return err
}

return bufMigrationPreRunHandler(cmd, session, appPath, cfg.Build.Proto.Path)
if err := bufMigrationPreRunHandler(cmd, session, appPath, cfg.Build.Proto.Path); err != nil {
return err
}

// we go mod tidy in case new dependencies were added or removed
if err := gocmd.ModTidy(cmd.Context(), appPath); err != nil {
return err
}

return nil
}

func scaffoldType(
Expand Down
Loading

0 comments on commit 6a6412a

Please sign in to comment.