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

Upgrade minimum required Go version to 1.20 #2754

Merged
merged 6 commits into from
Mar 1, 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 .docker/Dockerfile.adm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.21 as builder
FROM golang:1.22 as builder
ARG BUILD=now
ARG VERSION=dev
ARG REPO=repository
Expand Down
2 changes: 1 addition & 1 deletion .docker/Dockerfile.cli
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.21 as builder
FROM golang:1.22 as builder
ARG BUILD=now
ARG VERSION=dev
ARG REPO=repository
Expand Down
2 changes: 1 addition & 1 deletion .docker/Dockerfile.ir
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.21 as builder
FROM golang:1.22 as builder
ARG BUILD=now
ARG VERSION=dev
ARG REPO=repository
Expand Down
2 changes: 1 addition & 1 deletion .docker/Dockerfile.storage
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.21 as builder
FROM golang:1.22 as builder
ARG BUILD=now
ARG VERSION=dev
ARG REPO=repository
Expand Down
2 changes: 1 addition & 1 deletion .docker/Dockerfile.storage-testnet
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.21 as builder
FROM golang:1.22 as builder
ARG BUILD=now
ARG VERSION=dev
ARG REPO=repository
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.21'
go-version: '1.22'
cache: true

- name: Build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
go: [ '1.19.x', '1.20.x', '1.21' ]
go: [ '1.20.x', '1.21.x', '1.22' ]
steps:
- name: Setup go
uses: actions/setup-go@v5
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
uses: actions/setup-go@v5
with:
cache: true
go-version: '1.20'
go-version: '1.22'
- run: go version

- name: Set up Python
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Changelog for NeoFS Node
- Supporting of `__NEOFS__NETMAP*` X-headers (#2751)

### Updated
- Minimum required version of Go to 1.20

### Updating from v0.40.1
Remove `notification` section from all SN configuration files: it is no longer
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ VERSION ?= $(shell set -o pipefail; git describe --tags --dirty --match "v*" --a
HUB_IMAGE ?= nspccdev/neofs
HUB_TAG ?= $(VERSION)

GO_VERSION ?= 1.21
GO_VERSION ?= 1.22
LINT_VERSION ?= 1.55.0
ARCH = amd64

Expand Down
2 changes: 2 additions & 0 deletions cmd/blobovnicza-to-peapod/blobovnicza/blobovnicza_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
func testPutGet(t *testing.T, blz *Blobovnicza, addr oid.Address, sz uint64, assertErrPut, assertErrGet func(error) bool) oid.Address {
// create binary object
data := make([]byte, sz)
//nolint:staticcheck
rand.Read(data)

var pPut PutPrm
Expand Down Expand Up @@ -52,6 +53,7 @@ func testGet(t *testing.T, blz *Blobovnicza, addr oid.Address, expObj []byte, as
}

func TestBlobovnicza(t *testing.T) {
//nolint:staticcheck
rand.Seed(1024)

p := "./test_blz"
Expand Down
4 changes: 2 additions & 2 deletions cmd/blobovnicza-to-peapod/blobovnicza/get.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package blobovnicza

import (
"bytes"
"errors"

"github.com/nspcc-dev/neo-go/pkg/util/slice"
apistatus "github.com/nspcc-dev/neofs-sdk-go/client/status"
oid "github.com/nspcc-dev/neofs-sdk-go/object/id"
"go.etcd.io/bbolt"
Expand Down Expand Up @@ -52,7 +52,7 @@ func (b *Blobovnicza) Get(prm GetPrm) (GetRes, error) {
return nil
}

data = slice.Copy(data)
data = bytes.Clone(data)

return errInterruptForEach
})
Expand Down
4 changes: 2 additions & 2 deletions cmd/blobovnicza-to-peapod/blobovnicza/iterate_test.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package blobovnicza

import (
"bytes"
"errors"
"path/filepath"
"testing"

"github.com/nspcc-dev/neo-go/pkg/util/slice"
oidtest "github.com/nspcc-dev/neofs-sdk-go/object/id/test"
"github.com/stretchr/testify/require"
"go.etcd.io/bbolt"
Expand All @@ -29,7 +29,7 @@ func TestBlobovniczaIterate(t *testing.T) {

seen := make([][]byte, 0, 2)
inc := func(e IterationElement) error {
seen = append(seen, slice.Copy(e.data))
seen = append(seen, bytes.Clone(e.data))
return nil
}

Expand Down
5 changes: 0 additions & 5 deletions cmd/blobovnicza-to-peapod/blobovniczatree/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,9 @@ package blobovniczatree
import (
"errors"

"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/util/logicerr"
apistatus "github.com/nspcc-dev/neofs-sdk-go/client/status"
)

func isErrOutOfRange(err error) bool {
return errors.As(err, new(apistatus.ObjectOutOfRange))
}

func isLogical(err error) bool {
return errors.As(err, new(logicerr.Logical))
}
7 changes: 4 additions & 3 deletions cmd/blobovnicza-to-peapod/blobovniczatree/put.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

"github.com/nspcc-dev/neofs-node/cmd/blobovnicza-to-peapod/blobovnicza"
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobstor/common"
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/util/logicerr"
"go.etcd.io/bbolt"
"go.uber.org/zap"
)
Expand Down Expand Up @@ -35,7 +36,7 @@
fn = func(p string) (bool, error) {
active, err := b.getActivated(p)
if err != nil {
if !isLogical(err) {
if !errors.Is(err, logicerr.Error) {

Check warning on line 39 in cmd/blobovnicza-to-peapod/blobovniczatree/put.go

View check run for this annotation

Codecov / codecov/patch

cmd/blobovnicza-to-peapod/blobovniczatree/put.go#L39

Added line #L39 was not covered by tests
b.reportError("could not get active blobovnicza", err)
} else {
b.log.Debug("could not get active blobovnicza",
Expand All @@ -56,7 +57,7 @@
}

if err := b.updateActive(p, &active.ind); err != nil {
if !isLogical(err) {
if !errors.Is(err, logicerr.Error) {

Check warning on line 60 in cmd/blobovnicza-to-peapod/blobovniczatree/put.go

View check run for this annotation

Codecov / codecov/patch

cmd/blobovnicza-to-peapod/blobovniczatree/put.go#L60

Added line #L60 was not covered by tests
b.reportError("could not update active blobovnicza", err)
} else {
b.log.Debug("could not update active blobovnicza",
Expand All @@ -71,7 +72,7 @@
}

allFull = false
if !isLogical(err) {
if !errors.Is(err, logicerr.Error) {

Check warning on line 75 in cmd/blobovnicza-to-peapod/blobovniczatree/put.go

View check run for this annotation

Codecov / codecov/patch

cmd/blobovnicza-to-peapod/blobovniczatree/put.go#L75

Added line #L75 was not covered by tests
b.reportError("could not put object to active blobovnicza", err)
} else {
b.log.Debug("could not put object to active blobovnicza",
Expand Down
12 changes: 6 additions & 6 deletions cmd/neofs-adm/internal/modules/morph/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
func getContainersList(inv *invoker.Invoker, ch util.Uint160) ([][]byte, error) {
res, err := inv.Call(ch, "list", "")
if err != nil {
return nil, fmt.Errorf("%w: %v", errInvalidContainerResponse, err)
return nil, fmt.Errorf("%w: %w", errInvalidContainerResponse, err)

Check warning on line 45 in cmd/neofs-adm/internal/modules/morph/container.go

View check run for this annotation

Codecov / codecov/patch

cmd/neofs-adm/internal/modules/morph/container.go#L45

Added line #L45 was not covered by tests
}
itm, err := unwrap.Item(res, err)
if _, ok := itm.(stackitem.Null); !ok {
Expand Down Expand Up @@ -71,7 +71,7 @@

cids, err := getContainersList(inv, ch)
if err != nil {
return fmt.Errorf("%w: %v", errInvalidContainerResponse, err)
return fmt.Errorf("%w: %w", errInvalidContainerResponse, err)

Check warning on line 74 in cmd/neofs-adm/internal/modules/morph/container.go

View check run for this annotation

Codecov / codecov/patch

cmd/neofs-adm/internal/modules/morph/container.go#L74

Added line #L74 was not covered by tests
}

isOK, err := getCIDFilterFunc(cmd)
Expand Down Expand Up @@ -105,13 +105,13 @@
cnt := new(Container)
err = cnt.FromStackItem(res.Stack[0])
if err != nil {
return fmt.Errorf("%w: %v", errInvalidContainerResponse, err)
return fmt.Errorf("%w: %w", errInvalidContainerResponse, err)

Check warning on line 108 in cmd/neofs-adm/internal/modules/morph/container.go

View check run for this annotation

Codecov / codecov/patch

cmd/neofs-adm/internal/modules/morph/container.go#L108

Added line #L108 was not covered by tests
}

ea := new(EACL)
err = ea.FromStackItem(res.Stack[1])
if err != nil {
return fmt.Errorf("%w: %v", errInvalidContainerResponse, err)
return fmt.Errorf("%w: %w", errInvalidContainerResponse, err)

Check warning on line 114 in cmd/neofs-adm/internal/modules/morph/container.go

View check run for this annotation

Codecov / codecov/patch

cmd/neofs-adm/internal/modules/morph/container.go#L114

Added line #L114 was not covered by tests
}
if len(ea.Value) != 0 {
cnt.EACL = ea
Expand Down Expand Up @@ -142,7 +142,7 @@

cids, err := getContainersList(inv, ch)
if err != nil {
return fmt.Errorf("%w: %v", errInvalidContainerResponse, err)
return fmt.Errorf("%w: %w", errInvalidContainerResponse, err)

Check warning on line 145 in cmd/neofs-adm/internal/modules/morph/container.go

View check run for this annotation

Codecov / codecov/patch

cmd/neofs-adm/internal/modules/morph/container.go#L145

Added line #L145 was not covered by tests
}

for _, id := range cids {
Expand Down Expand Up @@ -218,7 +218,7 @@

old := new(Container)
if err := old.FromStackItem(res.Stack[0]); err != nil {
return fmt.Errorf("%w: %v", errInvalidContainerResponse, err)
return fmt.Errorf("%w: %w", errInvalidContainerResponse, err)

Check warning on line 221 in cmd/neofs-adm/internal/modules/morph/container.go

View check run for this annotation

Codecov / codecov/patch

cmd/neofs-adm/internal/modules/morph/container.go#L221

Added line #L221 was not covered by tests
}
if len(old.Value) != 0 {
var id cid.ID
Expand Down
8 changes: 2 additions & 6 deletions cmd/neofs-cli/internal/client/sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

err := addr.FromString(viper.GetString(endpointFlag))
if err != nil {
return nil, fmt.Errorf("%v: %w", errInvalidEndpoint, err)
return nil, fmt.Errorf("%w: %w", errInvalidEndpoint, err)

Check warning on line 35 in cmd/neofs-cli/internal/client/sdk.go

View check run for this annotation

Codecov / codecov/patch

cmd/neofs-cli/internal/client/sdk.go#L35

Added line #L35 was not covered by tests
}
return GetSDKClient(ctx, addr)
}
Expand Down Expand Up @@ -74,11 +74,7 @@
// This behavior is going to be fixed on SDK side.
//
// Track https://github.com/nspcc-dev/neofs-node/issues/2477
wErr := err
for e := errors.Unwrap(wErr); e != nil; e = errors.Unwrap(wErr) {
wErr = e
}
if status.Code(wErr) == codes.Unimplemented {
if status.Code(err) == codes.Unimplemented {

Check warning on line 77 in cmd/neofs-cli/internal/client/sdk.go

View check run for this annotation

Codecov / codecov/patch

cmd/neofs-cli/internal/client/sdk.go#L77

Added line #L77 was not covered by tests
return c, nil
}
return nil, fmt.Errorf("can't init SDK client: %w", err)
Expand Down
6 changes: 3 additions & 3 deletions cmd/neofs-cli/internal/key/raw.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@
if err != nil {
var perr = new(*os.PathError)
if errors.As(err, perr) {
return nil, fmt.Errorf("%w: %v", ErrFs, err)
return nil, fmt.Errorf("%w: %w", ErrFs, err)
}
return nil, fmt.Errorf("%w: %v", ErrInvalidKey, err)
return nil, fmt.Errorf("%w: %w", ErrInvalidKey, err)
}
return FromWallet(cmd, w, viper.GetString(commonflags.Account))
}
Expand Down Expand Up @@ -71,7 +71,7 @@

priv, err := keys.NewPrivateKey()
if err != nil {
return nil, fmt.Errorf("%w: %v", errCantGenerateKey, err)
return nil, fmt.Errorf("%w: %w", errCantGenerateKey, err)

Check warning on line 74 in cmd/neofs-cli/internal/key/raw.go

View check run for this annotation

Codecov / codecov/patch

cmd/neofs-cli/internal/key/raw.go#L74

Added line #L74 was not covered by tests
}

common.PrintVerbose(cmd, "Private key generated successfully. Public key: %s", priv.PublicKey())
Expand Down
4 changes: 2 additions & 2 deletions contracts/contracts.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,12 @@ func readContractFromFiles(_fs fs.FS, filePrefix string) (c Contract, err error)
bReader := io.NewBinReaderFromIO(fNEF)
c.NEF.DecodeBinary(bReader)
if bReader.Err != nil {
return c, fmt.Errorf("%w: %v", errInvalidNEF, bReader.Err)
return c, fmt.Errorf("%w: %w", errInvalidNEF, bReader.Err)
}

err = json.NewDecoder(fManifest).Decode(&c.Manifest)
if err != nil {
return c, fmt.Errorf("%w: %v", errInvalidManifest, err)
return c, fmt.Errorf("%w: %w", errInvalidManifest, err)
}

return
Expand Down
Loading
Loading