From 31ce65ce89442de4c185f38afdd54d7a892be3aa Mon Sep 17 00:00:00 2001 From: Anatol <87016465+notanatol@users.noreply.github.com> Date: Mon, 16 Oct 2023 15:23:42 +0300 Subject: [PATCH] chore: bump go version to 1.21.0 (#4250) --- .github/workflows/go.yml | 2 +- .golangci.yml | 2 +- Dockerfile | 2 +- pkg/encryption/encryption.go | 7 ------- pkg/skippeers/skippeers.go | 3 +-- pkg/storage/leveldbstore/recovery_test.go | 2 +- pkg/storer/internal/chunkstore/recovery.go | 2 +- pkg/storer/internal/chunkstore/recovery_test.go | 4 ++-- pkg/storer/reserve.go | 2 +- pkg/storer/uploadstore.go | 7 ------- pkg/topology/mock/mock.go | 2 +- 11 files changed, 10 insertions(+), 25 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index e25ec427cba..891b0ab317a 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -70,7 +70,7 @@ jobs: uses: golangci/golangci-lint-action@v3 with: skip-cache: false - version: v1.51 + version: v1.54.1 - name: Whitespace check run: make check-whitespace - name: go mod tidy check diff --git a/.golangci.yml b/.golangci.yml index d08108964f1..def3e2a3d8d 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -4,7 +4,7 @@ linters: enable: - asciicheck - bidichk - - depguard + # - depguard disable temporary until this issue is resolved: https://github.com/golangci/golangci-lint/issues/3906 - dogsled - durationcheck - errcheck diff --git a/Dockerfile b/Dockerfile index f3109ecddef..604285e2003 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.20 AS build +FROM golang:1.21 AS build WORKDIR /src # enable modules caching in separate layer diff --git a/pkg/encryption/encryption.go b/pkg/encryption/encryption.go index b3ef5198814..c0019dd76bd 100644 --- a/pkg/encryption/encryption.go +++ b/pkg/encryption/encryption.go @@ -185,10 +185,3 @@ func GenerateRandomKey(l int) Key { } return key } - -func min(x, y int) int { - if x < y { - return x - } - return y -} diff --git a/pkg/skippeers/skippeers.go b/pkg/skippeers/skippeers.go index 1cd3ef2d4e3..c512e5e0ae8 100644 --- a/pkg/skippeers/skippeers.go +++ b/pkg/skippeers/skippeers.go @@ -10,7 +10,6 @@ import ( "time" "github.com/ethersphere/bee/pkg/swarm" - "golang.org/x/exp/maps" ) const MaxDuration time.Duration = math.MaxInt64 @@ -131,7 +130,7 @@ func (l *List) Close() error { l.wg.Wait() l.mtx.Lock() - maps.Clear(l.skip) + clear(l.skip) l.mtx.Unlock() return nil diff --git a/pkg/storage/leveldbstore/recovery_test.go b/pkg/storage/leveldbstore/recovery_test.go index b7a7239dddc..f3d504f6e62 100644 --- a/pkg/storage/leveldbstore/recovery_test.go +++ b/pkg/storage/leveldbstore/recovery_test.go @@ -8,13 +8,13 @@ import ( "context" "encoding/json" "fmt" + "slices" "testing" "github.com/ethersphere/bee/pkg/storage" "github.com/ethersphere/bee/pkg/storage/leveldbstore" "github.com/ethersphere/bee/pkg/storage/storageutil" "github.com/google/go-cmp/cmp" - "golang.org/x/exp/slices" ) type obj struct { diff --git a/pkg/storer/internal/chunkstore/recovery.go b/pkg/storer/internal/chunkstore/recovery.go index d595f519e52..fad8d47e222 100644 --- a/pkg/storer/internal/chunkstore/recovery.go +++ b/pkg/storer/internal/chunkstore/recovery.go @@ -7,13 +7,13 @@ package chunkstore import ( "context" "fmt" + "slices" "github.com/ethersphere/bee/pkg/log" "github.com/ethersphere/bee/pkg/sharky" "github.com/ethersphere/bee/pkg/storage" "github.com/ethersphere/bee/pkg/storage/storageutil" "github.com/vmihailenco/msgpack/v5" - "golang.org/x/exp/slices" ) var _ storage.Item = (*pendingTx)(nil) diff --git a/pkg/storer/internal/chunkstore/recovery_test.go b/pkg/storer/internal/chunkstore/recovery_test.go index 2cb01a83655..99c5b0f8c76 100644 --- a/pkg/storer/internal/chunkstore/recovery_test.go +++ b/pkg/storer/internal/chunkstore/recovery_test.go @@ -8,8 +8,7 @@ import ( "context" "testing" - "github.com/google/go-cmp/cmp/cmpopts" - "golang.org/x/exp/slices" + "slices" "github.com/ethersphere/bee/pkg/sharky" "github.com/ethersphere/bee/pkg/storage" @@ -18,6 +17,7 @@ import ( "github.com/ethersphere/bee/pkg/storer/internal/chunkstore" "github.com/ethersphere/bee/pkg/swarm" "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" "github.com/spf13/afero" ) diff --git a/pkg/storer/reserve.go b/pkg/storer/reserve.go index 7d332d6ec07..9049cf5e02f 100644 --- a/pkg/storer/reserve.go +++ b/pkg/storer/reserve.go @@ -9,6 +9,7 @@ import ( "encoding/hex" "errors" "fmt" + "slices" "sync" "time" @@ -18,7 +19,6 @@ import ( "github.com/ethersphere/bee/pkg/storer/internal" "github.com/ethersphere/bee/pkg/storer/internal/reserve" "github.com/ethersphere/bee/pkg/swarm" - "golang.org/x/exp/slices" ) const ( diff --git a/pkg/storer/uploadstore.go b/pkg/storer/uploadstore.go index 0c7494007e0..9697c53bedf 100644 --- a/pkg/storer/uploadstore.go +++ b/pkg/storer/uploadstore.go @@ -138,13 +138,6 @@ func (db *DB) DeleteSession(tagID uint64) error { func (db *DB) ListSessions(offset, limit int) ([]SessionInfo, error) { const maxPageSize = 1000 - min := func(a, b int) int { - if a < b { - return a - } - return b - } - limit = min(limit, maxPageSize) tags, err := upload.ListAllTags(db.repo.IndexStore()) diff --git a/pkg/topology/mock/mock.go b/pkg/topology/mock/mock.go index d7287815a47..f052045920b 100644 --- a/pkg/topology/mock/mock.go +++ b/pkg/topology/mock/mock.go @@ -6,13 +6,13 @@ package mock import ( "context" + "maps" "sync" "time" "github.com/ethersphere/bee/pkg/p2p" "github.com/ethersphere/bee/pkg/swarm" "github.com/ethersphere/bee/pkg/topology" - "golang.org/x/exp/maps" ) type mock struct {