Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: upgrade to go 1.23 #10486

Merged
merged 2 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: 1.22.x
go-version: 1.23.x

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
steps:
- uses: actions/setup-go@v5
with:
go-version: 1.22.x
go-version: 1.23.x
- uses: actions/checkout@v4
- run: docker build -t $IMAGE_NAME:$WIP_IMAGE_TAG .
- run: docker run --rm $IMAGE_NAME:$WIP_IMAGE_TAG --version
4 changes: 2 additions & 2 deletions .github/workflows/gateway-conformance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: 1.22.x
go-version: 1.23.x
- uses: protocol/cache-go-action@v1
with:
name: ${{ github.job }}
Expand Down Expand Up @@ -136,7 +136,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: 1.22.x
go-version: 1.23.x
- uses: protocol/cache-go-action@v1
with:
name: ${{ github.job }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gobuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
steps:
- uses: actions/setup-go@v5
with:
go-version: 1.22.x
go-version: 1.23.x
- uses: actions/checkout@v4
- run: make cmd/ipfs-try-build
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/golang-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
submodules: recursive
- uses: actions/setup-go@v5
with:
go-version: "1.22.x"
go-version: "1.23.x"
- name: Check that go.mod is tidy
uses: protocol/multiple-go-modules@v1.4
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/golint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ jobs:
steps:
- uses: actions/setup-go@v5
with:
go-version: 1.22.x
go-version: 1.23.x
- uses: actions/checkout@v4
- run: make -O test_go_lint
2 changes: 1 addition & 1 deletion .github/workflows/gotest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.22.x
go-version: 1.23.x
- name: Check out Kubo
uses: actions/checkout@v4
- name: Install missing tools
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/interop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
- 'master'

env:
GO_VERSION: 1.22.x
GO_VERSION: 1.23.x

concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event_name == 'push' && github.sha || github.ref }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sharness.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: 1.22.x
go-version: 1.23.x
- name: Checkout Kubo
uses: actions/checkout@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.22 AS builder
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.23 AS builder

ARG TARGETOS TARGETARCH

Expand Down
2 changes: 1 addition & 1 deletion core/commands/bitswap.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ var bitswapStatCmd = &cmds.Command{
}

if !nd.IsOnline {
return cmds.Errorf(cmds.ErrClient, ErrNotOnline.Error())
return cmds.Errorf(cmds.ErrClient, "unable to run offline: %s", ErrNotOnline)
}

bs, ok := nd.Exchange.(*bitswap.Bitswap)
Expand Down
2 changes: 1 addition & 1 deletion core/commands/files.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ var filesStatCmd = &cmds.Command{
Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
_, err := statGetFormatOptions(req)
if err != nil {
return cmds.Errorf(cmds.ErrClient, err.Error())
return cmds.Errorf(cmds.ErrClient, "invalid parameters: %s", err)
}

node, err := cmdenv.GetNode(env)
Expand Down
2 changes: 1 addition & 1 deletion core/commands/name/ipnsps.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ var ipnspsCancelCmd = &cmds.Command{
name = strings.TrimPrefix(name, "/ipns/")
pid, err := peer.Decode(name)
if err != nil {
return cmds.Errorf(cmds.ErrClient, err.Error())
return cmds.Errorf(cmds.ErrClient, "not a valid IPNS name: %s", err)
}

ok, err := n.PSRouter.Cancel("/ipns/" + string(pid))
Expand Down
3 changes: 1 addition & 2 deletions core/commands/name/name.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,7 @@ Passing --verify will verify signature against provided public key.
if out.HexDump != "" {
tw.Flush()

fmt.Fprintf(w, "\nHex Dump:\n")
fmt.Fprintf(w, out.HexDump)
fmt.Fprintf(w, "\nHex Dump:\n%s", out.HexDump)
}

return nil
Expand Down
2 changes: 1 addition & 1 deletion core/commands/refs.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
var refsEncoderMap = cmds.EncoderMap{
cmds.Text: cmds.MakeTypedEncoder(func(req *cmds.Request, w io.Writer, out *RefWrapper) error {
if out.Err != "" {
return fmt.Errorf(out.Err)
return errors.New(out.Err)
}
fmt.Fprintln(w, out.Ref)

Expand Down
2 changes: 1 addition & 1 deletion core/commands/stat.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ Example:

// Must be online!
if !nd.IsOnline {
return cmds.Errorf(cmds.ErrClient, ErrNotOnline.Error())
return cmds.Errorf(cmds.ErrClient, "unable to run offline: %s", ErrNotOnline)
}

if nd.Reporter == nil {
Expand Down
2 changes: 1 addition & 1 deletion core/commands/swarm.go
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ var swarmAddrsCmd = &cmds.Command{
paddrs := am.Addrs[p]
fmt.Fprintf(w, "%s (%d)\n", p, len(paddrs))
for _, addr := range paddrs {
fmt.Fprintf(w, "\t"+addr+"\n")
fmt.Fprintf(w, "\t%s\n", addr)
}
}

Expand Down
4 changes: 1 addition & 3 deletions docs/examples/kubo-as-a-library/go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
module github.com/ipfs/kubo/examples/kubo-as-a-library

go 1.22

toolchain go1.22.0
go 1.23

// Used to keep this in sync with the current version of kubo. You should remove
// this if you copy this example.
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -253,4 +253,4 @@ require (
lukechampine.com/blake3 v1.3.0 // indirect
)

go 1.22
go 1.23
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to require go 1.23 to build kubo? I think we want to keep this at 1.22.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think its fine to require, we are not a library and https://github.com/ipfs/distributions/blob/master/.tool-versions uses 1.23 now.

3 changes: 2 additions & 1 deletion plugin/loader/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package loader

import (
"encoding/json"
"errors"
"fmt"
"io"
"os"
Expand Down Expand Up @@ -361,7 +362,7 @@ func (loader *PluginLoader) Close() error {
}
if errs != nil {
loader.state = loaderFailed
return fmt.Errorf(strings.Join(errs, "\n"))
return errors.New(strings.Join(errs, "\n"))
}
loader.state = loaderClosed
return nil
Expand Down
57 changes: 27 additions & 30 deletions test/dependencies/go.mod
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
module github.com/ipfs/kubo/test/dependencies

go 1.22

toolchain go1.22.0
go 1.23

replace github.com/ipfs/kubo => ../../

require (
github.com/Kubuxu/gocovmerge v0.0.0-20161216165753-7ecaa51963cd
github.com/golangci/golangci-lint v1.59.1
github.com/golangci/golangci-lint v1.60.2
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ bumping linter and fixing reported complains made CI green

github.com/ipfs/go-cidutil v0.1.0
github.com/ipfs/go-log v1.0.5
github.com/ipfs/hang-fds v0.1.0
Expand All @@ -28,9 +26,9 @@ require (
github.com/Abirdcfly/dupword v0.0.14 // indirect
github.com/Antonboom/errname v0.1.13 // indirect
github.com/Antonboom/nilnil v0.1.9 // indirect
github.com/Antonboom/testifylint v1.4.1 // indirect
github.com/BurntSushi/toml v1.4.0 // indirect
github.com/Crocmagnon/fatcontext v0.3.0 // indirect
github.com/Antonboom/testifylint v1.4.3 // indirect
github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c // indirect
github.com/Crocmagnon/fatcontext v0.4.0 // indirect
github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 // indirect
github.com/GaijinEntertainment/go-exhaustruct/v3 v3.3.0 // indirect
github.com/Masterminds/semver/v3 v3.2.1 // indirect
Expand All @@ -45,7 +43,7 @@ require (
github.com/bitfield/gotestdox v0.2.2 // indirect
github.com/bkielbasa/cyclop v1.2.1 // indirect
github.com/blizzy78/varnamelen v0.8.0 // indirect
github.com/bombsimon/wsl/v4 v4.4.0 // indirect
github.com/bombsimon/wsl/v4 v4.4.1 // indirect
github.com/breml/bidichk v0.2.7 // indirect
github.com/breml/errchkjson v0.3.6 // indirect
github.com/butuzov/ireturn v0.3.0 // indirect
Expand All @@ -56,7 +54,7 @@ require (
github.com/charithe/durationcheck v0.0.10 // indirect
github.com/chavacava/garif v0.1.0 // indirect
github.com/ckaznocha/intrange v0.1.2 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.3 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.4 // indirect
github.com/curioswitch/go-reassign v0.2.0 // indirect
github.com/daixiang0/gci v0.13.4 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
Expand Down Expand Up @@ -85,10 +83,10 @@ require (
github.com/go-viper/mapstructure/v2 v2.0.0 // indirect
github.com/go-xmlfmt/xmlfmt v1.1.2 // indirect
github.com/gobwas/glob v0.2.3 // indirect
github.com/gofrs/flock v0.8.1 // indirect
github.com/gofrs/flock v0.12.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a // indirect
github.com/golangci/gofmt v0.0.0-20231019111953-be8c47862aaa // indirect
github.com/golangci/gofmt v0.0.0-20240816233607-d8596aa466a9 // indirect
github.com/golangci/misspell v0.6.0 // indirect
github.com/golangci/modinfo v0.3.4 // indirect
github.com/golangci/plugin-module-register v0.1.1 // indirect
Expand Down Expand Up @@ -129,7 +127,7 @@ require (
github.com/jgautheron/goconst v1.7.1 // indirect
github.com/jingyugao/rowserrcheck v1.1.1 // indirect
github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af // indirect
github.com/jjti/go-spancheck v0.6.1 // indirect
github.com/jjti/go-spancheck v0.6.2 // indirect
github.com/julz/importas v0.1.0 // indirect
github.com/karamaru-alpha/copyloopvar v1.1.0 // indirect
github.com/kisielk/errcheck v1.7.0 // indirect
Expand Down Expand Up @@ -161,12 +159,12 @@ require (
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.15 // indirect
github.com/mgechev/revive v1.3.7 // indirect
github.com/mgechev/revive v1.3.9 // indirect
github.com/miekg/dns v1.1.61 // indirect
github.com/minio/sha256-simd v1.0.1 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/moricho/tparallel v0.3.1 // indirect
github.com/moricho/tparallel v0.3.2 // indirect
github.com/mr-tron/base58 v1.2.0 // indirect
github.com/multiformats/go-base32 v0.1.0 // indirect
github.com/multiformats/go-base36 v0.2.0 // indirect
Expand All @@ -186,7 +184,7 @@ require (
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/polydawn/refmt v0.89.0 // indirect
github.com/polyfloyd/go-errorlint v1.5.2 // indirect
github.com/polyfloyd/go-errorlint v1.6.0 // indirect
github.com/prometheus/client_golang v1.19.1 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.55.0 // indirect
Expand All @@ -198,7 +196,7 @@ require (
github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/ryancurrah/gomodguard v1.3.2 // indirect
github.com/ryancurrah/gomodguard v1.3.3 // indirect
github.com/ryanrolds/sqlclosecheck v0.5.1 // indirect
github.com/sagikazarmark/locafero v0.6.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
Expand All @@ -207,7 +205,7 @@ require (
github.com/santhosh-tekuri/jsonschema/v5 v5.3.1 // indirect
github.com/sashamelentyev/interfacebloat v1.1.0 // indirect
github.com/sashamelentyev/usestdlibvars v1.27.0 // indirect
github.com/securego/gosec/v2 v2.20.1-0.20240525090044-5f0084eb01a9 // indirect
github.com/securego/gosec/v2 v2.20.1-0.20240820084340-81cda2f91fbe // indirect
github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/sivchari/containedctx v1.0.3 // indirect
Expand All @@ -218,25 +216,24 @@ require (
github.com/spaolacci/murmur3 v1.1.0 // indirect
github.com/spf13/afero v1.11.0 // indirect
github.com/spf13/cast v1.6.0 // indirect
github.com/spf13/cobra v1.8.0 // indirect
github.com/spf13/cobra v1.8.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/viper v1.19.0 // indirect
github.com/ssgreg/nlreturn/v2 v2.2.1 // indirect
github.com/stbenjam/no-sprintf-host-port v0.1.1 // indirect
github.com/stretchr/objx v0.5.2 // indirect
github.com/stretchr/testify v1.9.0 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/t-yuki/gocover-cobertura v0.0.0-20180217150009-aaee18c8195c // indirect
github.com/tdakkota/asciicheck v0.2.0 // indirect
github.com/tetafro/godot v1.4.16 // indirect
github.com/timakin/bodyclose v0.0.0-20240125160201-f835fa56326a // indirect
github.com/timonwong/loggercheck v0.9.4 // indirect
github.com/tomarrell/wrapcheck/v2 v2.8.3 // indirect
github.com/tomarrell/wrapcheck/v2 v2.9.0 // indirect
github.com/tommy-muehle/go-mnd/v2 v2.5.1 // indirect
github.com/ultraware/funlen v0.1.0 // indirect
github.com/ultraware/whitespace v0.1.1 // indirect
github.com/urfave/cli v1.22.10 // indirect
github.com/uudashr/gocognit v1.1.2 // indirect
github.com/uudashr/gocognit v1.1.3 // indirect
github.com/whyrusleeping/base32 v0.0.0-20170828182744-c30ac30633cc // indirect
github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1 // indirect
github.com/xen0n/gosmopolitan v1.2.2 // indirect
Expand All @@ -245,31 +242,31 @@ require (
github.com/ykadowak/zerologlint v0.1.5 // indirect
gitlab.com/bosi/decorder v0.4.2 // indirect
go-simpler.org/musttag v0.12.2 // indirect
go-simpler.org/sloglint v0.7.1 // indirect
go-simpler.org/sloglint v0.7.2 // indirect
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/otel v1.28.0 // indirect
go.opentelemetry.io/otel/metric v1.28.0 // indirect
go.opentelemetry.io/otel/trace v1.28.0 // indirect
go.uber.org/automaxprocs v1.5.3 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.0 // indirect
golang.org/x/crypto v0.25.0 // indirect
golang.org/x/crypto v0.26.0 // indirect
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect
golang.org/x/exp/typeparams v0.0.0-20240613232115-7f521ea00fb8 // indirect
golang.org/x/mod v0.19.0 // indirect
golang.org/x/net v0.27.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/mod v0.20.0 // indirect
golang.org/x/net v0.28.0 // indirect
golang.org/x/sync v0.8.0 // indirect
golang.org/x/sys v0.24.0 // indirect
golang.org/x/term v0.23.0 // indirect
golang.org/x/text v0.16.0 // indirect
golang.org/x/tools v0.23.0 // indirect
golang.org/x/text v0.17.0 // indirect
golang.org/x/tools v0.24.0 // indirect
gonum.org/v1/gonum v0.15.0 // indirect
google.golang.org/protobuf v1.34.2 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
honnef.co/go/tools v0.4.7 // indirect
honnef.co/go/tools v0.5.1 // indirect
lukechampine.com/blake3 v1.3.0 // indirect
mvdan.cc/gofumpt v0.6.0 // indirect
mvdan.cc/gofumpt v0.7.0 // indirect
mvdan.cc/unparam v0.0.0-20240528143540-8a5130ca722f // indirect
)
Loading
Loading