From d772e35abaa863d1c204f330b63bc5a11403692f Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Mon, 17 Oct 2022 15:03:55 +0300 Subject: [PATCH] [#1910] .golangci.yml: Add `godot` linker Signed-off-by: Evgenii Stratonikov --- .golangci.yml | 1 + .../internal/modules/morph/subnet.go | 43 +++++++------------ cmd/neofs-cli/internal/common/netmap.go | 2 +- cmd/neofs-cli/internal/commonflags/flags.go | 10 ++--- cmd/neofs-cli/modules/accounting/root.go | 2 +- cmd/neofs-cli/modules/acl/extended/create.go | 2 + cmd/neofs-cli/modules/container/list.go | 4 +- .../modules/container/list_objects.go | 4 +- cmd/neofs-cli/modules/container/root.go | 2 +- cmd/neofs-cli/modules/object/root.go | 2 +- cmd/neofs-cli/modules/root.go | 2 +- cmd/neofs-cli/modules/storagegroup/root.go | 2 +- cmd/neofs-cli/modules/util/locode.go | 2 +- cmd/neofs-ir/main.go | 4 +- cmd/neofs-node/config.go | 2 +- cmd/neofs-node/config/cast.go | 2 +- cmd/neofs-node/config/config.go | 3 +- .../shard/blobstor/blobovnicza/config.go | 1 - .../config/engine/shard/boltdb/boltdb.go | 1 - .../config/engine/shard/gc/config.go | 1 - .../config/engine/shard/writecache/config.go | 1 - cmd/neofs-node/config/logger/config.go | 1 - cmd/neofs-node/container.go | 4 +- cmd/neofs-node/main.go | 2 +- cmd/neofs-node/netmap.go | 4 +- pkg/innerring/alphabet.go | 2 +- pkg/innerring/notary.go | 4 +- pkg/innerring/processors/balance/processor.go | 2 +- pkg/innerring/processors/governance/list.go | 2 +- pkg/innerring/processors/neofs/processor.go | 4 +- .../processors/settlement/basic/context.go | 2 +- .../processors/settlement/processor.go | 2 +- pkg/innerring/subnet.go | 7 +-- pkg/local_object_storage/engine/control.go | 2 +- pkg/local_object_storage/internal/log/log.go | 2 +- pkg/local_object_storage/metabase/util.go | 2 + pkg/local_object_storage/pilorama/boltdb.go | 20 ++++----- pkg/local_object_storage/shard/shard.go | 4 +- pkg/morph/client/balance/burn.go | 2 +- pkg/morph/client/client.go | 2 +- pkg/morph/client/multi.go | 2 +- pkg/morph/timer/block.go | 3 +- pkg/network/address.go | 2 +- pkg/network/validation.go | 6 +-- pkg/services/accounting/server.go | 2 +- .../load/controller/controller.go | 2 +- pkg/services/container/server.go | 2 +- pkg/services/netmap/server.go | 2 +- pkg/services/object/put/validation.go | 3 +- pkg/services/policer/check.go | 2 +- pkg/services/reputation/common/managers.go | 2 +- .../reputation/local/controller/controller.go | 2 +- pkg/services/session/server.go | 2 +- pkg/util/locode/db/point.go | 2 +- 54 files changed, 90 insertions(+), 107 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index c0321ea98..85c1b3a48 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -34,6 +34,7 @@ linters: # some default golangci-lint linters - errcheck - gosimple + - godot - ineffassign - staticcheck - typecheck diff --git a/cmd/neofs-adm/internal/modules/morph/subnet.go b/cmd/neofs-adm/internal/modules/morph/subnet.go index 1dc70f86e..65477684e 100644 --- a/cmd/neofs-adm/internal/modules/morph/subnet.go +++ b/cmd/neofs-adm/internal/modules/morph/subnet.go @@ -49,14 +49,10 @@ var cmdSubnet = &cobra.Command{ // shared flags of cmdSubnet sub-commands. const ( - // subnet identifier - flagSubnet = "subnet" - // subnet client group ID - flagSubnetGroup = "group" - // filepath to wallet - flagSubnetWallet = "wallet" - // address in the wallet, optional - flagSubnetAddress = "address" + flagSubnet = "subnet" // subnet identifier + flagSubnetGroup = "group" // subnet client group ID + flagSubnetWallet = "wallet" // filepath to wallet + flagSubnetAddress = "address" // address in the wallet, optional ) // reads wallet from the filepath configured in flagSubnetWallet flag, @@ -171,7 +167,7 @@ var cmdSubnetCreate = &cobra.Command{ // cmdSubnetRemove flags. const ( - // subnet ID to be removed + // subnet ID to be removed. flagSubnetRemoveID = flagSubnet ) @@ -223,7 +219,7 @@ var cmdSubnetRemove = &cobra.Command{ // cmdSubnetGet flags. const ( - // subnet ID to be read + // subnet ID to be read. flagSubnetGetID = flagSubnet ) @@ -286,12 +282,9 @@ var cmdSubnetGet = &cobra.Command{ // cmdSubnetAdmin subnet flags. const ( - // subnet ID to be managed - flagSubnetAdminSubnet = flagSubnet - // admin public key - flagSubnetAdminID = "admin" - // manage client admins instead of node ones - flagSubnetAdminClient = "client" + flagSubnetAdminSubnet = flagSubnet // subnet ID to be managed + flagSubnetAdminID = "admin" // admin public key + flagSubnetAdminClient = "client" // manage client admins instead of node ones ) // command to manage subnet admins. @@ -310,8 +303,7 @@ var cmdSubnetAdmin = &cobra.Command{ // cmdSubnetAdminAdd flags. const ( - // client group ID - flagSubnetAdminAddGroup = flagSubnetGroup + flagSubnetAdminAddGroup = flagSubnetGroup // client group ID ) // common executor cmdSubnetAdminAdd and cmdSubnetAdminRemove commands. @@ -433,12 +425,9 @@ var cmdSubnetAdminRemove = &cobra.Command{ // cmdSubnetClient flags. const ( - // ID of the subnet to be managed - flagSubnetClientSubnet = flagSubnet - // client's NeoFS ID - flagSubnetClientID = flagSubnetAdminClient - // ID of the subnet client group - flagSubnetClientGroup = flagSubnetGroup + flagSubnetClientSubnet = flagSubnet // ID of the subnet to be managed + flagSubnetClientID = flagSubnetAdminClient // client's NeoFS ID + flagSubnetClientGroup = flagSubnetGroup // ID of the subnet client group ) // command to manage subnet clients. @@ -544,10 +533,8 @@ var cmdSubnetClientRemove = &cobra.Command{ // cmdSubnetNode flags. const ( - // node ID - flagSubnetNode = "node" - // ID of the subnet to be managed - flagSubnetNodeSubnet = flagSubnet + flagSubnetNode = "node" // node ID + flagSubnetNodeSubnet = flagSubnet // ID of the subnet to be managed ) // common executor cmdSubnetNodeAdd and cmdSubnetNodeRemove commands. diff --git a/cmd/neofs-cli/internal/common/netmap.go b/cmd/neofs-cli/internal/common/netmap.go index 2045433f4..92093ffce 100644 --- a/cmd/neofs-cli/internal/common/netmap.go +++ b/cmd/neofs-cli/internal/common/netmap.go @@ -38,7 +38,7 @@ func PrettyPrintNodeInfo(cmd *cobra.Command, node netmap.NodeInfo, } } -// PrettyPrintNetMap print information about network map +// PrettyPrintNetMap print information about network map. func PrettyPrintNetMap(cmd *cobra.Command, nm netmap.NetMap) { cmd.Println("Epoch:", nm.Epoch()) diff --git a/cmd/neofs-cli/internal/commonflags/flags.go b/cmd/neofs-cli/internal/commonflags/flags.go index 48fc0d4e6..16a2353a0 100644 --- a/cmd/neofs-cli/internal/commonflags/flags.go +++ b/cmd/neofs-cli/internal/commonflags/flags.go @@ -44,11 +44,11 @@ const ( ) // Init adds common flags to the command: -// - GenerateKey -// - WalletPath -// - Account -// - RPC -// - Timeout +// - GenerateKey, +// - WalletPath, +// - Account, +// - RPC, +// - Timeout. func Init(cmd *cobra.Command) { InitWithoutRPC(cmd) diff --git a/cmd/neofs-cli/modules/accounting/root.go b/cmd/neofs-cli/modules/accounting/root.go index 15d12024b..4fba3f1ee 100644 --- a/cmd/neofs-cli/modules/accounting/root.go +++ b/cmd/neofs-cli/modules/accounting/root.go @@ -6,7 +6,7 @@ import ( "github.com/spf13/viper" ) -// Cmd represents the accounting command +// Cmd represents the accounting command. var Cmd = &cobra.Command{ Use: "accounting", Short: "Operations with accounts and balances", diff --git a/cmd/neofs-cli/modules/acl/extended/create.go b/cmd/neofs-cli/modules/acl/extended/create.go index 88b23aa0f..baef71ffb 100644 --- a/cmd/neofs-cli/modules/acl/extended/create.go +++ b/cmd/neofs-cli/modules/acl/extended/create.go @@ -146,6 +146,8 @@ func getRulesFromFile(filename string) ([]string, error) { // // Examples: // allow get req:X-Header=123 obj:Attr=value others:0xkey1,key2 system:key3 user:key4 +// +//nolint:godot func parseTable(tb *eacl.Table, args []string) error { if len(args) < 2 { return errors.New("at least 2 arguments must be provided") diff --git a/cmd/neofs-cli/modules/container/list.go b/cmd/neofs-cli/modules/container/list.go index 8c2772e54..39a788132 100644 --- a/cmd/neofs-cli/modules/container/list.go +++ b/cmd/neofs-cli/modules/container/list.go @@ -12,13 +12,13 @@ import ( "github.com/spf13/cobra" ) -// flags of list command +// flags of list command. const ( flagListPrintAttr = "with-attr" flagListContainerOwner = "owner" ) -// flag vars of list command +// flag vars of list command. var ( flagVarListPrintAttr bool flagVarListContainerOwner string diff --git a/cmd/neofs-cli/modules/container/list_objects.go b/cmd/neofs-cli/modules/container/list_objects.go index fd24f0b01..5b4da630a 100644 --- a/cmd/neofs-cli/modules/container/list_objects.go +++ b/cmd/neofs-cli/modules/container/list_objects.go @@ -15,12 +15,12 @@ import ( "github.com/spf13/cobra" ) -// flags of list-object command +// flags of list-object command. const ( flagListObjectPrintAttr = "with-attr" ) -// flag vars of list-objects command +// flag vars of list-objects command. var ( flagVarListObjectsPrintAttr bool ) diff --git a/cmd/neofs-cli/modules/container/root.go b/cmd/neofs-cli/modules/container/root.go index 182d0667f..50b5a3928 100644 --- a/cmd/neofs-cli/modules/container/root.go +++ b/cmd/neofs-cli/modules/container/root.go @@ -5,7 +5,7 @@ import ( "github.com/spf13/cobra" ) -// Cmd represents the container command +// Cmd represents the container command. var Cmd = &cobra.Command{ Use: "container", Short: "Operations with containers", diff --git a/cmd/neofs-cli/modules/object/root.go b/cmd/neofs-cli/modules/object/root.go index 0c076f254..d51b89f9b 100644 --- a/cmd/neofs-cli/modules/object/root.go +++ b/cmd/neofs-cli/modules/object/root.go @@ -5,7 +5,7 @@ import ( "github.com/spf13/cobra" ) -// Cmd represents the object command +// Cmd represents the object command. var Cmd = &cobra.Command{ Use: "object", Short: "Operations with Objects", diff --git a/cmd/neofs-cli/modules/root.go b/cmd/neofs-cli/modules/root.go index d824b9b30..32f4776eb 100644 --- a/cmd/neofs-cli/modules/root.go +++ b/cmd/neofs-cli/modules/root.go @@ -33,7 +33,7 @@ var ( cfgFile string ) -// rootCmd represents the base command when called without any subcommands +// rootCmd represents the base command when called without any subcommands. var rootCmd = &cobra.Command{ Use: "neofs-cli", Short: "Command Line Tool to work with NeoFS", diff --git a/cmd/neofs-cli/modules/storagegroup/root.go b/cmd/neofs-cli/modules/storagegroup/root.go index 534bbffe0..3a784b8e3 100644 --- a/cmd/neofs-cli/modules/storagegroup/root.go +++ b/cmd/neofs-cli/modules/storagegroup/root.go @@ -6,7 +6,7 @@ import ( "github.com/spf13/cobra" ) -// Cmd represents the storagegroup command +// Cmd represents the storagegroup command. var Cmd = &cobra.Command{ Use: "storagegroup", Short: "Operations with Storage Groups", diff --git a/cmd/neofs-cli/modules/util/locode.go b/cmd/neofs-cli/modules/util/locode.go index 8ebf62b9a..1e267eba7 100644 --- a/cmd/neofs-cli/modules/util/locode.go +++ b/cmd/neofs-cli/modules/util/locode.go @@ -4,7 +4,7 @@ import ( "github.com/spf13/cobra" ) -// locode section +// locode section. var locodeCmd = &cobra.Command{ Use: "locode", Short: "Working with NeoFS UN/LOCODE database", diff --git a/cmd/neofs-ir/main.go b/cmd/neofs-ir/main.go index a64085884..eff9e4457 100644 --- a/cmd/neofs-ir/main.go +++ b/cmd/neofs-ir/main.go @@ -19,10 +19,10 @@ import ( ) const ( - // ErrorReturnCode returns when application crashed at initialization stage + // ErrorReturnCode returns when application crashed at initialization stage. ErrorReturnCode = 1 - // SuccessReturnCode returns when application closed without panic + // SuccessReturnCode returns when application closed without panic. SuccessReturnCode = 0 ) diff --git a/cmd/neofs-node/config.go b/cmd/neofs-node/config.go index 3f2ac1fe6..12f91be9f 100644 --- a/cmd/neofs-node/config.go +++ b/cmd/neofs-node/config.go @@ -364,7 +364,7 @@ type shared struct { } // dynamicConfiguration stores parameters of the -// components that supports runtime reconfigurations +// components that supports runtime reconfigurations. type dynamicConfiguration struct { logger *logger.Prm } diff --git a/cmd/neofs-node/config/cast.go b/cmd/neofs-node/config/cast.go index 2c0fa03ff..cf0017ca5 100644 --- a/cmd/neofs-node/config/cast.go +++ b/cmd/neofs-node/config/cast.go @@ -189,7 +189,7 @@ func safeMul(size float64, multiplier uint64) uint64 { return lo } -// parseSizeInBytes converts strings like 1GB or 12 mb into an unsigned integer number of bytes +// parseSizeInBytes converts strings like 1GB or 12 mb into an unsigned integer number of bytes. func parseSizeInBytes(sizeStr string) uint64 { sizeStr = strings.TrimSpace(sizeStr) lastChar := len(sizeStr) - 1 diff --git a/cmd/neofs-node/config/config.go b/cmd/neofs-node/config/config.go index 0cb79be9d..c68bed9fc 100644 --- a/cmd/neofs-node/config/config.go +++ b/cmd/neofs-node/config/config.go @@ -60,8 +60,7 @@ func New(_ Prm, opts ...Option) *Config { } } -// Reload reads configuration path if any was provided -// to the New. Returns any +// Reload reads configuration path if it was provided to New. func (x *Config) Reload() error { if x.opts.path != "" { err := x.v.ReadInConfig() diff --git a/cmd/neofs-node/config/engine/shard/blobstor/blobovnicza/config.go b/cmd/neofs-node/config/engine/shard/blobstor/blobovnicza/config.go index dc4916175..3861ffa05 100644 --- a/cmd/neofs-node/config/engine/shard/blobstor/blobovnicza/config.go +++ b/cmd/neofs-node/config/engine/shard/blobstor/blobovnicza/config.go @@ -10,7 +10,6 @@ import ( // which provides access to Blobovnicza configurations. type Config config.Config -// config defaults const ( // SizeDefault is a default limit of estimates of Blobovnicza size. SizeDefault = 1 << 30 diff --git a/cmd/neofs-node/config/engine/shard/boltdb/boltdb.go b/cmd/neofs-node/config/engine/shard/boltdb/boltdb.go index b337daccb..ed35130aa 100644 --- a/cmd/neofs-node/config/engine/shard/boltdb/boltdb.go +++ b/cmd/neofs-node/config/engine/shard/boltdb/boltdb.go @@ -11,7 +11,6 @@ import ( // which provides access to boltdb specific parameters. type Config config.Config -// config defaults const ( // PermDefault is a default permission bits for metabase file. PermDefault = 0660 diff --git a/cmd/neofs-node/config/engine/shard/gc/config.go b/cmd/neofs-node/config/engine/shard/gc/config.go index 7547415c8..30e28e1cb 100644 --- a/cmd/neofs-node/config/engine/shard/gc/config.go +++ b/cmd/neofs-node/config/engine/shard/gc/config.go @@ -10,7 +10,6 @@ import ( // which provides access to Shard's GC configurations. type Config config.Config -// config defaults const ( // RemoverBatchSizeDefault is a default batch size for Shard GC's remover. RemoverBatchSizeDefault = 100 diff --git a/cmd/neofs-node/config/engine/shard/writecache/config.go b/cmd/neofs-node/config/engine/shard/writecache/config.go index 36be9195e..909d15842 100644 --- a/cmd/neofs-node/config/engine/shard/writecache/config.go +++ b/cmd/neofs-node/config/engine/shard/writecache/config.go @@ -9,7 +9,6 @@ import ( // which provides access to WriteCache configurations. type Config config.Config -// config defaults const ( // SmallSizeDefault is a default size of small objects. SmallSizeDefault = 32 << 10 diff --git a/cmd/neofs-node/config/logger/config.go b/cmd/neofs-node/config/logger/config.go index 1b73b76a6..f994db056 100644 --- a/cmd/neofs-node/config/logger/config.go +++ b/cmd/neofs-node/config/logger/config.go @@ -4,7 +4,6 @@ import ( "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config" ) -// config defaults const ( // LevelDefault is a default logger level. LevelDefault = "info" diff --git a/cmd/neofs-node/container.go b/cmd/neofs-node/container.go index 1e57873aa..9116e46b9 100644 --- a/cmd/neofs-node/container.go +++ b/cmd/neofs-node/container.go @@ -215,7 +215,7 @@ func initContainerService(c *cfg) { } } -// addContainerNotificationHandler adds handler that will be executed synchronously +// addContainerNotificationHandler adds handler that will be executed synchronously. func addContainerNotificationHandler(c *cfg, sTyp string, h event.Handler) { typ := event.TypeFromString(sTyp) @@ -226,7 +226,7 @@ func addContainerNotificationHandler(c *cfg, sTyp string, h event.Handler) { c.cfgContainer.subscribers[typ] = append(c.cfgContainer.subscribers[typ], h) } -// addContainerAsyncNotificationHandler adds handler that will be executed asynchronously via container workerPool +// addContainerAsyncNotificationHandler adds handler that will be executed asynchronously via container workerPool. func addContainerAsyncNotificationHandler(c *cfg, sTyp string, h event.Handler) { addContainerNotificationHandler( c, diff --git a/cmd/neofs-node/main.go b/cmd/neofs-node/main.go index 498337f4b..6edca30b6 100644 --- a/cmd/neofs-node/main.go +++ b/cmd/neofs-node/main.go @@ -16,7 +16,7 @@ import ( ) const ( - // SuccessReturnCode returns when application closed without panic + // SuccessReturnCode returns when application closed without panic. SuccessReturnCode = 0 ) diff --git a/cmd/neofs-node/netmap.go b/cmd/neofs-node/netmap.go index 43a46c184..068e9dfd6 100644 --- a/cmd/neofs-node/netmap.go +++ b/cmd/neofs-node/netmap.go @@ -315,12 +315,12 @@ func (c *cfg) netmapLocalNodeState(epoch uint64) (*netmapSDK.NodeInfo, error) { return nil, nil } -// addNewEpochNotificationHandler adds handler that will be executed synchronously +// addNewEpochNotificationHandler adds handler that will be executed synchronously. func addNewEpochNotificationHandler(c *cfg, h event.Handler) { addNetmapNotificationHandler(c, newEpochNotification, h) } -// addNewEpochAsyncNotificationHandler adds handler that will be executed asynchronously via netmap workerPool +// addNewEpochAsyncNotificationHandler adds handler that will be executed asynchronously via netmap workerPool. func addNewEpochAsyncNotificationHandler(c *cfg, h event.Handler) { addNetmapNotificationHandler( c, diff --git a/pkg/innerring/alphabet.go b/pkg/innerring/alphabet.go index b5f2c2a1c..be16f8232 100644 --- a/pkg/innerring/alphabet.go +++ b/pkg/innerring/alphabet.go @@ -52,7 +52,7 @@ const ( lastLetterNum ) -// returns string in config-compatible format +// String returns l in config-compatible format. func (l GlagoliticLetter) String() string { switch l { default: diff --git a/pkg/innerring/notary.go b/pkg/innerring/notary.go index 11d001409..fe1f277ea 100644 --- a/pkg/innerring/notary.go +++ b/pkg/innerring/notary.go @@ -20,11 +20,11 @@ type ( const ( // gasMultiplier defines how many times more the notary // balance must be compared to the GAS balance of the IR: - // notaryBalance = GASBalance * gasMultiplier + // notaryBalance = GASBalance * gasMultiplier. gasMultiplier = 3 // gasDivisor defines what part of GAS balance (1/gasDivisor) - // should be transferred to the notary service + // should be transferred to the notary service. gasDivisor = 2 ) diff --git a/pkg/innerring/processors/balance/processor.go b/pkg/innerring/processors/balance/processor.go index c31e6507e..b73826850 100644 --- a/pkg/innerring/processors/balance/processor.go +++ b/pkg/innerring/processors/balance/processor.go @@ -14,7 +14,7 @@ import ( ) type ( - // AlphabetState is a callback interface for inner ring global state + // AlphabetState is a callback interface for inner ring global state. AlphabetState interface { IsAlphabet() bool } diff --git a/pkg/innerring/processors/governance/list.go b/pkg/innerring/processors/governance/list.go index 0f561deb1..9f982f7c6 100644 --- a/pkg/innerring/processors/governance/list.go +++ b/pkg/innerring/processors/governance/list.go @@ -85,7 +85,7 @@ func newAlphabetList(sidechain, mainnet keys.PublicKeys) (keys.PublicKeys, error // updateInnerRing function removes `before` keys from `innerRing` and adds // `after` keys in the list. If the length of `before` and `after` is not the same, -// the function returns errNotEqualLen +// the function returns errNotEqualLen. func updateInnerRing(innerRing, before, after keys.PublicKeys) (keys.PublicKeys, error) { lnBefore := len(before) if lnBefore != len(after) { diff --git a/pkg/innerring/processors/neofs/processor.go b/pkg/innerring/processors/neofs/processor.go index f156dea79..08917b4fe 100644 --- a/pkg/innerring/processors/neofs/processor.go +++ b/pkg/innerring/processors/neofs/processor.go @@ -20,12 +20,12 @@ import ( ) type ( - // EpochState is a callback interface for inner ring global state + // EpochState is a callback interface for inner ring global state. EpochState interface { EpochCounter() uint64 } - // AlphabetState is a callback interface for inner ring global state + // AlphabetState is a callback interface for inner ring global state. AlphabetState interface { IsAlphabet() bool } diff --git a/pkg/innerring/processors/settlement/basic/context.go b/pkg/innerring/processors/settlement/basic/context.go index 6b5b4339a..ad4bf036c 100644 --- a/pkg/innerring/processors/settlement/basic/context.go +++ b/pkg/innerring/processors/settlement/basic/context.go @@ -20,7 +20,7 @@ type ( BasicRate() (uint64, error) } - // BalanceFetcher uses NEP-17 compatible balance contract + // BalanceFetcher uses NEP-17 compatible balance contract. BalanceFetcher interface { Balance(id user.ID) (*big.Int, error) } diff --git a/pkg/innerring/processors/settlement/processor.go b/pkg/innerring/processors/settlement/processor.go index 7fb2da633..f02f8bfb5 100644 --- a/pkg/innerring/processors/settlement/processor.go +++ b/pkg/innerring/processors/settlement/processor.go @@ -12,7 +12,7 @@ import ( ) type ( - // AlphabetState is a callback interface for inner ring global state + // AlphabetState is a callback interface for inner ring global state. AlphabetState interface { IsAlphabet() bool } diff --git a/pkg/innerring/subnet.go b/pkg/innerring/subnet.go index 7d8fcc391..ec8ea2822 100644 --- a/pkg/innerring/subnet.go +++ b/pkg/innerring/subnet.go @@ -85,11 +85,8 @@ func (s *Server) stopSubnet() { // names of listened notification events from Subnet contract. const ( - // subnet creation - subnetCreateEvName = "Put" - // subnet removal - subnetRemoveEvName = "Delete" - // subnet creation (notary) + subnetCreateEvName = "Put" + subnetRemoveEvName = "Delete" notarySubnetCreateEvName = "put" ) diff --git a/pkg/local_object_storage/engine/control.go b/pkg/local_object_storage/engine/control.go index 216267cb9..8fd2ed253 100644 --- a/pkg/local_object_storage/engine/control.go +++ b/pkg/local_object_storage/engine/control.go @@ -214,7 +214,7 @@ func (rCfg *ReConfiguration) SetErrorsThreshold(errorsThreshold uint32) { rCfg.errorsThreshold = errorsThreshold } -// SetShardPoolSize sets a size of worker pool for each shard +// SetShardPoolSize sets a size of worker pool for each shard. func (rCfg *ReConfiguration) SetShardPoolSize(shardPoolSize uint32) { rCfg.shardPoolSize = shardPoolSize } diff --git a/pkg/local_object_storage/internal/log/log.go b/pkg/local_object_storage/internal/log/log.go index 08e27e108..6424b2094 100644 --- a/pkg/local_object_storage/internal/log/log.go +++ b/pkg/local_object_storage/internal/log/log.go @@ -5,7 +5,7 @@ import ( "go.uber.org/zap" ) -// a distinctive part of all messages +// headMsg is a distinctive part of all messages. const headMsg = "local object storage operation" // Write writes message about storage engine's operation to logger. diff --git a/pkg/local_object_storage/metabase/util.go b/pkg/local_object_storage/metabase/util.go index eae4f49f4..132870d10 100644 --- a/pkg/local_object_storage/metabase/util.go +++ b/pkg/local_object_storage/metabase/util.go @@ -28,6 +28,8 @@ var ( // Prefix bytes for database keys. All ids and addresses are encoded in binary // unless specified otherwise. +// +//nolint:godot const ( // graveyardPrefix is used for the graveyard bucket. // Key: object address diff --git a/pkg/local_object_storage/pilorama/boltdb.go b/pkg/local_object_storage/pilorama/boltdb.go index 033085df0..7e010d87e 100644 --- a/pkg/local_object_storage/pilorama/boltdb.go +++ b/pkg/local_object_storage/pilorama/boltdb.go @@ -43,11 +43,11 @@ var ( // timestamp in big-endian -> log operation // // tree storage (dataBucket): -// 't' + node (id) -> timestamp when the node first appeared -// 'p' + node (id) -> parent (id) -// 'm' + node (id) -> serialized meta -// 'c' + parent (id) + child (id) -> 0/1 -// 'i' + 0 + attrKey + 0 + attrValue + 0 + parent (id) + node (id) -> 0/1 (1 for automatically created nodes) +// - 't' + node (id) -> timestamp when the node first appeared, +// - 'p' + node (id) -> parent (id), +// - 'm' + node (id) -> serialized meta, +// - 'c' + parent (id) + child (id) -> 0/1, +// - 'i' + 0 + attrKey + 0 + attrValue + 0 + parent (id) + node (id) -> 0/1 (1 for automatically created nodes). func NewBoltForest(opts ...Option) ForestStorage { b := boltForest{ cfg: cfg{ @@ -660,28 +660,28 @@ func bucketName(cid cidSDK.ID, treeID string) []byte { return []byte(cid.String() + treeID) } -// 't' + node (id) -> timestamp when the node first appeared +// 't' + node (id) -> timestamp when the node first appeared. func timestampKey(key []byte, child Node) []byte { key[0] = 't' binary.LittleEndian.PutUint64(key[1:], child) return key[:9] } -// 'p' + node (id) -> parent (id) +// 'p' + node (id) -> parent (id). func parentKey(key []byte, child Node) []byte { key[0] = 'p' binary.LittleEndian.PutUint64(key[1:], child) return key[:9] } -// 'm' + node (id) -> serialized meta +// 'm' + node (id) -> serialized meta. func metaKey(key []byte, child Node) []byte { key[0] = 'm' binary.LittleEndian.PutUint64(key[1:], child) return key[:9] } -// 'c' + parent (id) + child (id) -> 0/1 +// 'c' + parent (id) + child (id) -> 0/1. func childrenKey(key []byte, child, parent Node) []byte { key[0] = 'c' binary.LittleEndian.PutUint64(key[1:], parent) @@ -689,7 +689,7 @@ func childrenKey(key []byte, child, parent Node) []byte { return key[:17] } -// 'i' + attribute name (string) + attribute value (string) + parent (id) + node (id) -> 0/1 +// 'i' + attribute name (string) + attribute value (string) + parent (id) + node (id) -> 0/1. func internalKey(key []byte, k, v string, parent, node Node) []byte { size := 1 /* prefix */ + 2*2 /* len */ + 2*8 /* nodes */ + len(k) + len(v) if cap(key) < size { diff --git a/pkg/local_object_storage/shard/shard.go b/pkg/local_object_storage/shard/shard.go index 033b7bbaf..ad7852377 100644 --- a/pkg/local_object_storage/shard/shard.go +++ b/pkg/local_object_storage/shard/shard.go @@ -296,12 +296,12 @@ func (s *Shard) fillInfo() { const ( // physical is a physically stored object - // counter type + // counter type. physical = "phy" // logical is a logically stored object // counter type (excludes objects that are - // stored but unavailable) + // stored but unavailable). logical = "logic" ) diff --git a/pkg/morph/client/balance/burn.go b/pkg/morph/client/balance/burn.go index 7d148a4fd..08d7aa60a 100644 --- a/pkg/morph/client/balance/burn.go +++ b/pkg/morph/client/balance/burn.go @@ -24,7 +24,7 @@ func (b *BurnPrm) SetAmount(amount int64) { b.amount = amount } -// SetID sets ID +// SetID sets ID. func (b *BurnPrm) SetID(id []byte) { b.id = id } diff --git a/pkg/morph/client/client.go b/pkg/morph/client/client.go index 04bb4ea40..24cc54c70 100644 --- a/pkg/morph/client/client.go +++ b/pkg/morph/client/client.go @@ -214,7 +214,7 @@ func (c *Client) TestInvoke(contract util.Uint160, method string, args ...interf return val.Stack, nil } -// TransferGas to the receiver from local wallet +// TransferGas to the receiver from local wallet. func (c *Client) TransferGas(receiver util.Uint160, amount fixedn.Fixed8) error { c.switchLock.RLock() defer c.switchLock.RUnlock() diff --git a/pkg/morph/client/multi.go b/pkg/morph/client/multi.go index fe95777fd..7441cd99a 100644 --- a/pkg/morph/client/multi.go +++ b/pkg/morph/client/multi.go @@ -121,7 +121,7 @@ func (c *Client) notificationLoop() { } } -// close closes notification channel and wrapped WS client +// close closes notification channel and wrapped WS client. func (c *Client) close() { close(c.notifications) c.client.Close() diff --git a/pkg/morph/timer/block.go b/pkg/morph/timer/block.go index a8b6b78c9..31c28e2ff 100644 --- a/pkg/morph/timer/block.go +++ b/pkg/morph/timer/block.go @@ -45,8 +45,7 @@ type deltaCfg struct { pulse bool } -// WithPulse returns option to call delta-interval handler multiple -// times +// WithPulse returns option to call delta-interval handler multiple times. func WithPulse() DeltaOption { return func(c *deltaCfg) { c.pulse = true diff --git a/pkg/network/address.go b/pkg/network/address.go index 3419d8756..f5e0345e8 100644 --- a/pkg/network/address.go +++ b/pkg/network/address.go @@ -86,7 +86,7 @@ func (a *Address) FromString(s string) error { return err } -// multiaddrStringFromHostAddr converts "localhost:8080" to "/dns4/localhost/tcp/8080" +// multiaddrStringFromHostAddr converts "localhost:8080" to "/dns4/localhost/tcp/8080". func multiaddrStringFromHostAddr(host string) (string, error) { endpoint, port, err := net.SplitHostPort(host) if err != nil { diff --git a/pkg/network/validation.go b/pkg/network/validation.go index 6075deb24..8d818943a 100644 --- a/pkg/network/validation.go +++ b/pkg/network/validation.go @@ -8,7 +8,7 @@ import ( const ( // maxProtocolsAmount is maximal amount of protocols - // in multiaddress after parsing with network.AddressFromString + // in multiaddress after parsing with network.AddressFromString. maxProtocolsAmount = 3 // minProtocolsAmount is minimal amount of protocols @@ -16,10 +16,10 @@ const ( // host(ip) and port. minProtocolsAmount = 2 - // network protocols + // network protocols. dns, ip4, ip6 = "dns4", "ip4", "ip6" - // transport protocols + // transport protocols. tcp = "tcp" ) diff --git a/pkg/services/accounting/server.go b/pkg/services/accounting/server.go index 0acd0ae1d..f76b4f4eb 100644 --- a/pkg/services/accounting/server.go +++ b/pkg/services/accounting/server.go @@ -6,7 +6,7 @@ import ( "github.com/nspcc-dev/neofs-api-go/v2/accounting" ) -// Server is an interface of the NeoFS API Accounting service server +// Server is an interface of the NeoFS API Accounting service server. type Server interface { Balance(context.Context, *accounting.BalanceRequest) (*accounting.BalanceResponse, error) } diff --git a/pkg/services/container/announcement/load/controller/controller.go b/pkg/services/container/announcement/load/controller/controller.go index f5f3391ff..16c809ac5 100644 --- a/pkg/services/container/announcement/load/controller/controller.go +++ b/pkg/services/container/announcement/load/controller/controller.go @@ -66,7 +66,7 @@ func panicOnPrmValue(n string, v interface{}) { // Panics if at least one value of the parameters is invalid. // // The created Controller does not require additional -// initialization and is completely ready for work +// initialization and is completely ready for work. func New(prm Prm, opts ...Option) *Controller { switch { case prm.LocalMetrics == nil: diff --git a/pkg/services/container/server.go b/pkg/services/container/server.go index c1fd24b24..090c79a00 100644 --- a/pkg/services/container/server.go +++ b/pkg/services/container/server.go @@ -6,7 +6,7 @@ import ( "github.com/nspcc-dev/neofs-api-go/v2/container" ) -// Server is an interface of the NeoFS API Container service server +// Server is an interface of the NeoFS API Container service server. type Server interface { Put(context.Context, *container.PutRequest) (*container.PutResponse, error) Get(context.Context, *container.GetRequest) (*container.GetResponse, error) diff --git a/pkg/services/netmap/server.go b/pkg/services/netmap/server.go index cbd668396..a7440efb6 100644 --- a/pkg/services/netmap/server.go +++ b/pkg/services/netmap/server.go @@ -6,7 +6,7 @@ import ( "github.com/nspcc-dev/neofs-api-go/v2/netmap" ) -// Server is an interface of the NeoFS API Netmap service server +// Server is an interface of the NeoFS API Netmap service server. type Server interface { LocalNodeInfo(context.Context, *netmap.LocalNodeInfoRequest) (*netmap.LocalNodeInfoResponse, error) NetworkInfo(context.Context, *netmap.NetworkInfoRequest) (*netmap.NetworkInfoResponse, error) diff --git a/pkg/services/object/put/validation.go b/pkg/services/object/put/validation.go index e17dfa73c..a3b629285 100644 --- a/pkg/services/object/put/validation.go +++ b/pkg/services/object/put/validation.go @@ -33,9 +33,10 @@ type validatingTarget struct { writtenPayload uint64 // number of already written payload bytes } -// errors related to invalid payload size var ( + // ErrExceedingMaxSize is returned when chunk payload size is greater than the length declared in header. ErrExceedingMaxSize = errors.New("payload size is greater than the limit") + // ErrWrongPayloadSize is returned when payload size is greater than the limit. ErrWrongPayloadSize = errors.New("wrong payload size") ) diff --git a/pkg/services/policer/check.go b/pkg/services/policer/check.go index c1b663caf..b89a311e8 100644 --- a/pkg/services/policer/check.go +++ b/pkg/services/policer/check.go @@ -15,7 +15,7 @@ import ( "go.uber.org/zap" ) -// tracks Policer's check progress +// tracks Policer's check progress. type nodeCache map[uint64]bool func newNodeCache() *nodeCache { diff --git a/pkg/services/reputation/common/managers.go b/pkg/services/reputation/common/managers.go index 4d31cd807..eb0fbb9b7 100644 --- a/pkg/services/reputation/common/managers.go +++ b/pkg/services/reputation/common/managers.go @@ -54,7 +54,7 @@ func NewManagerBuilder(prm ManagersPrm, opts ...MngOption) ManagerBuilder { } } -// implements Server on apiNetmap.NodeInfo +// implements Server on apiNetmap.NodeInfo. type nodeServer apiNetmap.NodeInfo func (x nodeServer) PublicKey() []byte { diff --git a/pkg/services/reputation/local/controller/controller.go b/pkg/services/reputation/local/controller/controller.go index 0ce60aa90..70cf59374 100644 --- a/pkg/services/reputation/local/controller/controller.go +++ b/pkg/services/reputation/local/controller/controller.go @@ -61,7 +61,7 @@ func panicOnPrmValue(n string, v interface{}) { // Panics if at least one value of the parameters is invalid. // // The created Controller does not require additional -// initialization and is completely ready for work +// initialization and is completely ready for work. func New(prm Prm, opts ...Option) *Controller { switch { case prm.LocalTrustSource == nil: diff --git a/pkg/services/session/server.go b/pkg/services/session/server.go index cd8e1d602..f72997f42 100644 --- a/pkg/services/session/server.go +++ b/pkg/services/session/server.go @@ -6,7 +6,7 @@ import ( "github.com/nspcc-dev/neofs-api-go/v2/session" ) -// Server is an interface of the NeoFS API Session service server +// Server is an interface of the NeoFS API Session service server. type Server interface { Create(context.Context, *session.CreateRequest) (*session.CreateResponse, error) } diff --git a/pkg/util/locode/db/point.go b/pkg/util/locode/db/point.go index ee5b345f3..7a2879c9f 100644 --- a/pkg/util/locode/db/point.go +++ b/pkg/util/locode/db/point.go @@ -82,7 +82,7 @@ func toDecimal(intRaw, minutesRaw []byte) (float64, error) { return integer + decimal, nil } -// minutesToDegrees converts minutes to decimal part of a degree +// minutesToDegrees converts minutes to decimal part of a degree. func minutesToDegrees(raw []byte) (float64, error) { minutes, err := strconv.ParseFloat(string(raw), 64) if err != nil {