Skip to content

Commit

Permalink
chore: upgrade to go 1.23 (#10486)
Browse files Browse the repository at this point in the history
* chore: upgrade to go 1.23

https://tip.golang.org/doc/go1.23

* refactor: golangci-lint v1.60.2

(cherry picked from commit 2260e35)
  • Loading branch information
lidel committed Aug 28, 2024
1 parent f0d2c99 commit 2b245e0
Show file tree
Hide file tree
Showing 22 changed files with 107 additions and 114 deletions.
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 @@ -252,4 +252,4 @@ require (
lukechampine.com/blake3 v1.3.0 // indirect
)

go 1.22
go 1.23
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
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

0 comments on commit 2b245e0

Please sign in to comment.