[#1910] .golangci.yml: Add godot linker

Signed-off-by: Evgenii Stratonikov <evgeniy@morphbits.ru>
This commit is contained in:
Evgenii Stratonikov 2022-10-17 15:03:55 +03:00 committed by fyrchik
parent 347912ea0b
commit d772e35aba
54 changed files with 90 additions and 107 deletions

View file

@ -34,6 +34,7 @@ linters:
# some default golangci-lint linters
- errcheck
- gosimple
- godot
- ineffassign
- staticcheck
- typecheck

View file

@ -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.

View file

@ -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())

View file

@ -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)

View file

@ -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",

View file

@ -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")

View file

@ -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

View file

@ -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
)

View file

@ -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",

View file

@ -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",

View file

@ -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",

View file

@ -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",

View file

@ -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",

View file

@ -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
)

View file

@ -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
}

View file

@ -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

View file

@ -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()

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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"

View file

@ -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,

View file

@ -16,7 +16,7 @@ import (
)
const (
// SuccessReturnCode returns when application closed without panic
// SuccessReturnCode returns when application closed without panic.
SuccessReturnCode = 0
)

View file

@ -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,

View file

@ -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:

View file

@ -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
)

View file

@ -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
}

View file

@ -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) {

View file

@ -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
}

View file

@ -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)
}

View file

@ -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
}

View file

@ -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)
notarySubnetCreateEvName = "put"
)

View file

@ -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
}

View file

@ -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.

View file

@ -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

View file

@ -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 {

View file

@ -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"
)

View file

@ -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
}

View file

@ -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()

View file

@ -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()

View file

@ -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

View file

@ -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 {

View file

@ -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"
)

View file

@ -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)
}

View file

@ -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:

View file

@ -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)

View file

@ -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)

View file

@ -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")
)

View file

@ -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 {

View file

@ -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 {

View file

@ -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:

View file

@ -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)
}

View file

@ -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 {