From f07e2d481209da5b2794b8eb1886fba7036ae9f4 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Wed, 26 Apr 2023 11:24:40 +0300 Subject: [PATCH] [#285] lint: Fix revive/unused-parameter Signed-off-by: Evgenii Stratonikov --- cmd/frostfs-adm/internal/modules/config/config.go | 2 +- cmd/frostfs-adm/internal/modules/morph/epoch.go | 2 +- cmd/frostfs-adm/internal/modules/morph/generate.go | 2 +- .../internal/modules/morph/initialize.go | 6 +++--- .../internal/modules/morph/local_client.go | 2 +- cmd/frostfs-adm/internal/modules/root.go | 2 +- pkg/innerring/initialization.go | 2 +- pkg/innerring/innerring.go | 2 +- .../blobstor/blobovniczatree/delete.go | 14 +++++++------- pkg/local_object_storage/blobstor/fstree/fstree.go | 2 +- pkg/network/cache/multi.go | 2 +- pkg/services/accounting/morph/executor.go | 2 +- pkg/services/container/morph/executor.go | 8 ++++---- pkg/services/control/server/set_netmap_status.go | 2 +- pkg/services/netmap/executor.go | 2 +- pkg/services/object_manager/placement/netmap.go | 2 +- .../session/storage/persistent/executor.go | 2 +- pkg/services/session/storage/temporary/executor.go | 2 +- pkg/services/tree/service.go | 6 +++--- 19 files changed, 32 insertions(+), 32 deletions(-) diff --git a/cmd/frostfs-adm/internal/modules/config/config.go b/cmd/frostfs-adm/internal/modules/config/config.go index 13e575933..ebefe1d2c 100644 --- a/cmd/frostfs-adm/internal/modules/config/config.go +++ b/cmd/frostfs-adm/internal/modules/config/config.go @@ -47,7 +47,7 @@ credentials: {{.}}: password{{end}} ` -func initConfig(cmd *cobra.Command, args []string) error { +func initConfig(cmd *cobra.Command, _ []string) error { configPath, err := readConfigPathFromArgs(cmd) if err != nil { return nil diff --git a/cmd/frostfs-adm/internal/modules/morph/epoch.go b/cmd/frostfs-adm/internal/modules/morph/epoch.go index 608ff6b43..1f622fa89 100644 --- a/cmd/frostfs-adm/internal/modules/morph/epoch.go +++ b/cmd/frostfs-adm/internal/modules/morph/epoch.go @@ -13,7 +13,7 @@ import ( "github.com/spf13/viper" ) -func forceNewEpochCmd(cmd *cobra.Command, args []string) error { +func forceNewEpochCmd(cmd *cobra.Command, _ []string) error { wCtx, err := newInitializeContext(cmd, viper.GetViper()) if err != nil { return fmt.Errorf("can't to initialize context: %w", err) diff --git a/cmd/frostfs-adm/internal/modules/morph/generate.go b/cmd/frostfs-adm/internal/modules/morph/generate.go index 23637fed3..e714482dd 100644 --- a/cmd/frostfs-adm/internal/modules/morph/generate.go +++ b/cmd/frostfs-adm/internal/modules/morph/generate.go @@ -29,7 +29,7 @@ const ( consensusAccountName = "consensus" ) -func generateAlphabetCreds(cmd *cobra.Command, args []string) error { +func generateAlphabetCreds(cmd *cobra.Command, _ []string) error { // alphabet size is not part of the config size, err := cmd.Flags().GetUint(alphabetSizeFlag) if err != nil { diff --git a/cmd/frostfs-adm/internal/modules/morph/initialize.go b/cmd/frostfs-adm/internal/modules/morph/initialize.go index a99a5faff..2f4721653 100644 --- a/cmd/frostfs-adm/internal/modules/morph/initialize.go +++ b/cmd/frostfs-adm/internal/modules/morph/initialize.go @@ -45,7 +45,7 @@ type initializeContext struct { ContractPath string } -func initializeSideChainCmd(cmd *cobra.Command, args []string) error { +func initializeSideChainCmd(cmd *cobra.Command, _ []string) error { initCtx, err := newInitializeContext(cmd, viper.GetViper()) if err != nil { return fmt.Errorf("initialization error: %w", err) @@ -142,7 +142,7 @@ func newInitializeContext(cmd *cobra.Command, v *viper.Viper) (*initializeContex return nil, err } - ctrPath, err := getContractsPath(cmd, v, needContracts) + ctrPath, err := getContractsPath(cmd, needContracts) if err != nil { return nil, err } @@ -222,7 +222,7 @@ func getWallet(cmd *cobra.Command, v *viper.Viper, needContracts bool, walletDir return openContractWallet(v, cmd, walletDir) } -func getContractsPath(cmd *cobra.Command, v *viper.Viper, needContracts bool) (string, error) { +func getContractsPath(cmd *cobra.Command, needContracts bool) (string, error) { if !needContracts { return "", nil } diff --git a/cmd/frostfs-adm/internal/modules/morph/local_client.go b/cmd/frostfs-adm/internal/modules/morph/local_client.go index 94ccedb37..816f9da4c 100644 --- a/cmd/frostfs-adm/internal/modules/morph/local_client.go +++ b/cmd/frostfs-adm/internal/modules/morph/local_client.go @@ -248,7 +248,7 @@ func (l *localClient) GetVersion() (*result.Version, error) { }, nil } -func (l *localClient) InvokeContractVerify(contract util.Uint160, params []smartcontract.Parameter, signers []transaction.Signer, witnesses ...transaction.Witness) (*result.Invoke, error) { +func (l *localClient) InvokeContractVerify(util.Uint160, []smartcontract.Parameter, []transaction.Signer, ...transaction.Witness) (*result.Invoke, error) { // not used by `morph init` command panic("unexpected call") } diff --git a/cmd/frostfs-adm/internal/modules/root.go b/cmd/frostfs-adm/internal/modules/root.go index 4e30d5e62..fd1517f90 100644 --- a/cmd/frostfs-adm/internal/modules/root.go +++ b/cmd/frostfs-adm/internal/modules/root.go @@ -52,7 +52,7 @@ func Execute() error { return rootCmd.Execute() } -func entryPoint(cmd *cobra.Command, args []string) error { +func entryPoint(cmd *cobra.Command, _ []string) error { printVersion, _ := cmd.Flags().GetBool("version") if printVersion { cmd.Print(misc.BuildInfo("FrostFS Adm")) diff --git a/pkg/innerring/initialization.go b/pkg/innerring/initialization.go index 31602a48e..7e0c310fa 100644 --- a/pkg/innerring/initialization.go +++ b/pkg/innerring/initialization.go @@ -159,7 +159,7 @@ func (s *Server) enableNotarySupport() error { return nil } -func (s *Server) initNotaryConfig(cfg *viper.Viper) { +func (s *Server) initNotaryConfig() { s.mainNotaryConfig, s.sideNotaryConfig = notaryConfigs( s.morphClient.ProbeNotary(), !s.withoutMainNet && s.mainnetClient.ProbeNotary(), // if mainnet disabled then notary flag must be disabled too diff --git a/pkg/innerring/innerring.go b/pkg/innerring/innerring.go index 42917f1d6..2cb29b90a 100644 --- a/pkg/innerring/innerring.go +++ b/pkg/innerring/innerring.go @@ -359,7 +359,7 @@ func New(ctx context.Context, log *logger.Logger, cfg *viper.Viper, errChan chan return nil, err } - server.initNotaryConfig(cfg) + server.initNotaryConfig() err = server.initContracts(cfg) if err != nil { diff --git a/pkg/local_object_storage/blobstor/blobovniczatree/delete.go b/pkg/local_object_storage/blobstor/blobovniczatree/delete.go index 073e69b57..f84d8fbe8 100644 --- a/pkg/local_object_storage/blobstor/blobovniczatree/delete.go +++ b/pkg/local_object_storage/blobstor/blobovniczatree/delete.go @@ -42,7 +42,7 @@ func (b *Blobovniczas) Delete(ctx context.Context, prm common.DeletePrm) (res co return res, err } - return b.deleteObject(ctx, blz, bPrm, prm) + return b.deleteObject(ctx, blz, bPrm) } activeCache := make(map[string]struct{}) @@ -54,7 +54,7 @@ func (b *Blobovniczas) Delete(ctx context.Context, prm common.DeletePrm) (res co // don't process active blobovnicza of the level twice _, ok := activeCache[dirPath] - res, err = b.deleteObjectFromLevel(ctx, bPrm, p, !ok, prm) + res, err = b.deleteObjectFromLevel(ctx, bPrm, p, !ok) if err != nil { if !blobovnicza.IsErrNotFound(err) { b.log.Debug(logs.BlobovniczatreeCouldNotRemoveObjectFromLevel, @@ -85,7 +85,7 @@ func (b *Blobovniczas) Delete(ctx context.Context, prm common.DeletePrm) (res co // tries to delete object from particular blobovnicza. // // returns no error if object was removed from some blobovnicza of the same level. -func (b *Blobovniczas) deleteObjectFromLevel(ctx context.Context, prm blobovnicza.DeletePrm, blzPath string, tryActive bool, dp common.DeletePrm) (common.DeleteRes, error) { +func (b *Blobovniczas) deleteObjectFromLevel(ctx context.Context, prm blobovnicza.DeletePrm, blzPath string, tryActive bool) (common.DeleteRes, error) { lvlPath := filepath.Dir(blzPath) // try to remove from blobovnicza if it is opened @@ -93,7 +93,7 @@ func (b *Blobovniczas) deleteObjectFromLevel(ctx context.Context, prm blobovnicz v, ok := b.opened.Get(blzPath) b.lruMtx.Unlock() if ok { - if res, err := b.deleteObject(ctx, v, prm, dp); err == nil { + if res, err := b.deleteObject(ctx, v, prm); err == nil { return res, err } else if !blobovnicza.IsErrNotFound(err) { b.log.Debug(logs.BlobovniczatreeCouldNotRemoveObjectFromOpenedBlobovnicza, @@ -112,7 +112,7 @@ func (b *Blobovniczas) deleteObjectFromLevel(ctx context.Context, prm blobovnicz b.activeMtx.RUnlock() if ok && tryActive { - if res, err := b.deleteObject(ctx, active.blz, prm, dp); err == nil { + if res, err := b.deleteObject(ctx, active.blz, prm); err == nil { return res, err } else if !blobovnicza.IsErrNotFound(err) { b.log.Debug(logs.BlobovniczatreeCouldNotRemoveObjectFromActiveBlobovnicza, @@ -137,11 +137,11 @@ func (b *Blobovniczas) deleteObjectFromLevel(ctx context.Context, prm blobovnicz return common.DeleteRes{}, err } - return b.deleteObject(ctx, blz, prm, dp) + return b.deleteObject(ctx, blz, prm) } // removes object from blobovnicza and returns common.DeleteRes. -func (b *Blobovniczas) deleteObject(ctx context.Context, blz *blobovnicza.Blobovnicza, prm blobovnicza.DeletePrm, dp common.DeletePrm) (common.DeleteRes, error) { +func (b *Blobovniczas) deleteObject(ctx context.Context, blz *blobovnicza.Blobovnicza, prm blobovnicza.DeletePrm) (common.DeleteRes, error) { _, err := blz.Delete(ctx, prm) return common.DeleteRes{}, err } diff --git a/pkg/local_object_storage/blobstor/fstree/fstree.go b/pkg/local_object_storage/blobstor/fstree/fstree.go index 8eb0d5be9..75f63193a 100644 --- a/pkg/local_object_storage/blobstor/fstree/fstree.go +++ b/pkg/local_object_storage/blobstor/fstree/fstree.go @@ -468,6 +468,6 @@ func (t *FSTree) SetCompressor(cc *compression.Config) { } // SetReportErrorFunc implements common.Storage. -func (t *FSTree) SetReportErrorFunc(f func(string, error)) { +func (t *FSTree) SetReportErrorFunc(_ func(string, error)) { // Do nothing, FSTree can encounter only one error which is returned. } diff --git a/pkg/network/cache/multi.go b/pkg/network/cache/multi.go index b1afaa90d..b8a0aa4bc 100644 --- a/pkg/network/cache/multi.go +++ b/pkg/network/cache/multi.go @@ -277,7 +277,7 @@ func (x *multiClient) ObjectSearchInit(ctx context.Context, p client.PrmObjectSe return } -func (x *multiClient) ExecRaw(f func(client *rawclient.Client) error) error { +func (x *multiClient) ExecRaw(func(client *rawclient.Client) error) error { panic("multiClient.ExecRaw() must not be called") } diff --git a/pkg/services/accounting/morph/executor.go b/pkg/services/accounting/morph/executor.go index 434c89508..ac836b71d 100644 --- a/pkg/services/accounting/morph/executor.go +++ b/pkg/services/accounting/morph/executor.go @@ -21,7 +21,7 @@ func NewExecutor(client *balance.Client) accountingSvc.ServiceExecutor { } } -func (s *morphExecutor) Balance(ctx context.Context, body *accounting.BalanceRequestBody) (*accounting.BalanceResponseBody, error) { +func (s *morphExecutor) Balance(_ context.Context, body *accounting.BalanceRequestBody) (*accounting.BalanceResponseBody, error) { idV2 := body.GetOwnerID() if idV2 == nil { return nil, errors.New("missing account") diff --git a/pkg/services/container/morph/executor.go b/pkg/services/container/morph/executor.go index 42035c8d0..8e6b30856 100644 --- a/pkg/services/container/morph/executor.go +++ b/pkg/services/container/morph/executor.go @@ -136,7 +136,7 @@ func (s *morphExecutor) Delete(_ context.Context, tokV2 *sessionV2.Token, body * return new(container.DeleteResponseBody), nil } -func (s *morphExecutor) Get(ctx context.Context, body *container.GetRequestBody) (*container.GetResponseBody, error) { +func (s *morphExecutor) Get(_ context.Context, body *container.GetRequestBody) (*container.GetResponseBody, error) { idV2 := body.GetContainerID() if idV2 == nil { return nil, errors.New("missing container ID") @@ -176,7 +176,7 @@ func (s *morphExecutor) Get(ctx context.Context, body *container.GetRequestBody) return res, nil } -func (s *morphExecutor) List(ctx context.Context, body *container.ListRequestBody) (*container.ListResponseBody, error) { +func (s *morphExecutor) List(_ context.Context, body *container.ListRequestBody) (*container.ListResponseBody, error) { idV2 := body.GetOwnerID() if idV2 == nil { return nil, fmt.Errorf("missing user ID") @@ -205,7 +205,7 @@ func (s *morphExecutor) List(ctx context.Context, body *container.ListRequestBod return res, nil } -func (s *morphExecutor) SetExtendedACL(ctx context.Context, tokV2 *sessionV2.Token, body *container.SetExtendedACLRequestBody) (*container.SetExtendedACLResponseBody, error) { +func (s *morphExecutor) SetExtendedACL(_ context.Context, tokV2 *sessionV2.Token, body *container.SetExtendedACLRequestBody) (*container.SetExtendedACLResponseBody, error) { sigV2 := body.GetSignature() if sigV2 == nil { // TODO(@cthulhu-rider): #1387 use "const" error @@ -238,7 +238,7 @@ func (s *morphExecutor) SetExtendedACL(ctx context.Context, tokV2 *sessionV2.Tok return new(container.SetExtendedACLResponseBody), nil } -func (s *morphExecutor) GetExtendedACL(ctx context.Context, body *container.GetExtendedACLRequestBody) (*container.GetExtendedACLResponseBody, error) { +func (s *morphExecutor) GetExtendedACL(_ context.Context, body *container.GetExtendedACLRequestBody) (*container.GetExtendedACLResponseBody, error) { idV2 := body.GetContainerID() if idV2 == nil { return nil, errors.New("missing container ID") diff --git a/pkg/services/control/server/set_netmap_status.go b/pkg/services/control/server/set_netmap_status.go index ba7e682c6..d4a856952 100644 --- a/pkg/services/control/server/set_netmap_status.go +++ b/pkg/services/control/server/set_netmap_status.go @@ -11,7 +11,7 @@ import ( // SetNetmapStatus sets node status in FrostFS network. // // If request is unsigned or signed by disallowed key, permission error returns. -func (s *Server) SetNetmapStatus(ctx context.Context, req *control.SetNetmapStatusRequest) (*control.SetNetmapStatusResponse, error) { +func (s *Server) SetNetmapStatus(_ context.Context, req *control.SetNetmapStatusRequest) (*control.SetNetmapStatusResponse, error) { // verify request if err := s.isValidRequest(req); err != nil { return nil, status.Error(codes.PermissionDenied, err.Error()) diff --git a/pkg/services/netmap/executor.go b/pkg/services/netmap/executor.go index 9fa3d767f..d77c69d4d 100644 --- a/pkg/services/netmap/executor.go +++ b/pkg/services/netmap/executor.go @@ -129,7 +129,7 @@ func (s *executorSvc) NetworkInfo( return resp, nil } -func (s *executorSvc) Snapshot(_ context.Context, req *netmap.SnapshotRequest) (*netmap.SnapshotResponse, error) { +func (s *executorSvc) Snapshot(_ context.Context, _ *netmap.SnapshotRequest) (*netmap.SnapshotResponse, error) { var nm netmap.NetMap err := s.state.ReadCurrentNetMap(&nm) diff --git a/pkg/services/object_manager/placement/netmap.go b/pkg/services/object_manager/placement/netmap.go index 01d607020..787c04421 100644 --- a/pkg/services/object_manager/placement/netmap.go +++ b/pkg/services/object_manager/placement/netmap.go @@ -47,7 +47,7 @@ func NewNetworkMapSourceBuilder(nmSrc netmap.Source) Builder { } } -func (s *netMapSrc) GetNetMap(diff uint64) (*netmapSDK.NetMap, error) { +func (s *netMapSrc) GetNetMap(_ uint64) (*netmapSDK.NetMap, error) { return s.nm, nil } diff --git a/pkg/services/session/storage/persistent/executor.go b/pkg/services/session/storage/persistent/executor.go index f59e312c4..21f55a7d1 100644 --- a/pkg/services/session/storage/persistent/executor.go +++ b/pkg/services/session/storage/persistent/executor.go @@ -17,7 +17,7 @@ import ( // encrypts private keys if storage has been configured so). // Returns response that is filled with just created token's // ID and public key for it. -func (s *TokenStore) Create(ctx context.Context, body *session.CreateRequestBody) (*session.CreateResponseBody, error) { +func (s *TokenStore) Create(_ context.Context, body *session.CreateRequestBody) (*session.CreateResponseBody, error) { idV2 := body.GetOwnerID() if idV2 == nil { return nil, errors.New("missing owner") diff --git a/pkg/services/session/storage/temporary/executor.go b/pkg/services/session/storage/temporary/executor.go index aa64d796b..cd498709c 100644 --- a/pkg/services/session/storage/temporary/executor.go +++ b/pkg/services/session/storage/temporary/executor.go @@ -12,7 +12,7 @@ import ( "github.com/nspcc-dev/neo-go/pkg/crypto/keys" ) -func (s *TokenStore) Create(ctx context.Context, body *session.CreateRequestBody) (*session.CreateResponseBody, error) { +func (s *TokenStore) Create(_ context.Context, body *session.CreateRequestBody) (*session.CreateResponseBody, error) { idV2 := body.GetOwnerID() if idV2 == nil { return nil, errors.New("missing owner") diff --git a/pkg/services/tree/service.go b/pkg/services/tree/service.go index 35dfda3df..546b7a207 100644 --- a/pkg/services/tree/service.go +++ b/pkg/services/tree/service.go @@ -455,7 +455,7 @@ func getSubTree(ctx context.Context, srv TreeService_GetSubTreeServer, cid cidSD } // Apply locally applies operation from the remote node to the tree. -func (s *Service) Apply(ctx context.Context, req *ApplyRequest) (*ApplyResponse, error) { +func (s *Service) Apply(_ context.Context, req *ApplyRequest) (*ApplyResponse, error) { err := verifyMessage(req) if err != nil { return nil, err @@ -468,7 +468,7 @@ func (s *Service) Apply(ctx context.Context, req *ApplyRequest) (*ApplyResponse, key := req.GetSignature().GetKey() - _, pos, _, err := s.getContainerInfo(ctx, cid, key) + _, pos, _, err := s.getContainerInfo(cid, key) if err != nil { return nil, err } @@ -623,7 +623,7 @@ func metaToProto(arr []pilorama.KeyValue) []*KeyValue { // getContainerInfo returns the list of container nodes, position in the container for the node // with pub key and total amount of nodes in all replicas. -func (s *Service) getContainerInfo(ctx context.Context, cid cidSDK.ID, pub []byte) ([]netmapSDK.NodeInfo, int, int, error) { +func (s *Service) getContainerInfo(cid cidSDK.ID, pub []byte) ([]netmapSDK.NodeInfo, int, int, error) { cntNodes, _, err := s.getContainerNodes(cid) if err != nil { return nil, 0, 0, err