Skip to content

Commit

Permalink
*: fix lint errors
Browse files Browse the repository at this point in the history
- `unused`
- `errorlint: non-wrapping format verb for fmt.Errorf. Use `%w` to format
errors`
- `variable collides with imported package name`

Signed-off-by: Andrey Butusov <[email protected]>
  • Loading branch information
End-rey committed Oct 1, 2024
1 parent 9751852 commit 3e7856a
Show file tree
Hide file tree
Showing 12 changed files with 15 additions and 24 deletions.
2 changes: 1 addition & 1 deletion cmd/neofs-cli/internal/common/token.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func ReadBearerToken(cmd *cobra.Command, flagname string) (*bearer.Token, error)

err = ReadBinaryOrJSON(cmd, &tok, path)
if err != nil {
return nil, fmt.Errorf("invalid bearer token: %v", err)
return nil, fmt.Errorf("invalid bearer token: %w", err)
}

return &tok, nil
Expand Down
4 changes: 2 additions & 2 deletions cmd/neofs-cli/modules/acl/extended/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,13 @@ func createEACL(cmd *cobra.Command, _ []string) error {
var containerID cid.ID
if cidArg != "" {
if err := containerID.DecodeString(cidArg); err != nil {
return fmt.Errorf("invalid container ID: %v\n", err)
return fmt.Errorf("invalid container ID: %w\n", err)
}
}

rulesFile, err := getRulesFromFile(fileArg)
if err != nil {
return fmt.Errorf("can't read rules from file: %v\n", err)
return fmt.Errorf("can't read rules from file: %w\n", err)
}

rules = append(rules, rulesFile...)
Expand Down
2 changes: 1 addition & 1 deletion cmd/neofs-cli/modules/container/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ It will be stored in sidechain when inner ring will accepts it.`,
for ; ; t.Reset(waitInterval) {
select {
case <-ctx.Done():
return fmt.Errorf("container creation: %s", common.ErrAwaitTimeout)
return fmt.Errorf("container creation: %w", common.ErrAwaitTimeout)
case <-t.C:
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/neofs-cli/modules/container/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ Only owner of the container has a permission to remove container.`,
for ; ; t.Reset(waitInterval) {
select {
case <-ctx.Done():
return fmt.Errorf("container deletion: %s", common.ErrAwaitTimeout)
return fmt.Errorf("container deletion: %w", common.ErrAwaitTimeout)
case <-t.C:
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/neofs-cli/modules/container/set_eacl.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ Container ID in EACL table will be substituted with ID from the CLI.`,
for ; ; t.Reset(waitInterval) {
select {
case <-ctx.Done():
return fmt.Errorf("eACL setting: %s", common.ErrAwaitTimeout)
return fmt.Errorf("eACL setting: %w", common.ErrAwaitTimeout)
case <-t.C:
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/neofs-cli/modules/container/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func getSession(cmd *cobra.Command) (*session.Container, error) {

err := common.ReadBinaryOrJSON(cmd, &res, path)
if err != nil {
return nil, fmt.Errorf("read container session: %v", err)
return nil, fmt.Errorf("read container session: %w", err)
}

common.PrintVerbose(cmd, "Session successfully read.")
Expand Down
2 changes: 1 addition & 1 deletion cmd/neofs-cli/modules/object/lock.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ var objectLockCmd = &cobra.Command{
var cnr cid.ID
err := cnr.DecodeString(cidRaw)
if err != nil {
return fmt.Errorf("Incorrect container arg: %v", err)
return fmt.Errorf("Incorrect container arg: %w", err)
}

oidsRaw, _ := cmd.Flags().GetStringSlice(commonflags.OIDFlag)
Expand Down
2 changes: 1 addition & 1 deletion cmd/neofs-cli/modules/object/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ func getSession(cmd *cobra.Command) (*session.Object, error) {

err := common.ReadBinaryOrJSON(cmd, &tok, path)
if err != nil {
return nil, fmt.Errorf("read session: %v", err)
return nil, fmt.Errorf("read session: %w", err)
}

return &tok, nil
Expand Down
2 changes: 1 addition & 1 deletion cmd/neofs-cli/modules/util/sign_session.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func signSessionToken(cmd *cobra.Command, _ []string) error {
}

if errLast != nil {
return fmt.Errorf("decode session: %v", errLast)
return fmt.Errorf("decode session: %w", errLast)
}

pk, err := key.GetOrGenerate(cmd)
Expand Down
6 changes: 3 additions & 3 deletions pkg/innerring/processors/neofs/process_assets.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@ func (np *Processor) processDeposit(deposit *neofsEvent.Deposit) {

// get gas balance of the node
// before gas transfer check if the balance is greater than the threshold
balance, err := np.morphClient.GasBalance()
gasBalance, err := np.morphClient.GasBalance()
if err != nil {
np.log.Error("can't get gas balance of the node", zap.Error(err))
return
}

if balance < np.gasBalanceThreshold {
if gasBalance < np.gasBalanceThreshold {
np.log.Warn("gas balance threshold has been reached",
zap.Int64("balance", balance),
zap.Int64("balance", gasBalance),
zap.Int64("threshold", np.gasBalanceThreshold))

return
Expand Down
9 changes: 0 additions & 9 deletions pkg/local_object_storage/engine/lock_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package engine

import (
"context"
"os"
"strconv"
"testing"
Expand All @@ -20,14 +19,6 @@ import (
"github.com/stretchr/testify/require"
)

type tss struct {
expEpoch uint64
}

func (t tss) IsTombstoneAvailable(ctx context.Context, _ oid.Address, epoch uint64) bool {
return t.expEpoch >= epoch
}

func TestLockUserScenario(t *testing.T) {
// Tested user actions:
// 1. stores some object
Expand Down
4 changes: 2 additions & 2 deletions pkg/services/object/get/remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ func (exec *execCtx) processNode(info client.NodeInfo) bool {

l.Debug("processing node...")

client, ok := exec.remoteClient(info)
remoteClient, ok := exec.remoteClient(info)
if !ok {
return true
}

obj, err := client.getObject(exec, info)
obj, err := remoteClient.getObject(exec, info)

var errSplitInfo *objectSDK.SplitInfoError

Expand Down

0 comments on commit 3e7856a

Please sign in to comment.