[#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 # some default golangci-lint linters
- errcheck - errcheck
- gosimple - gosimple
- godot
- ineffassign - ineffassign
- staticcheck - staticcheck
- typecheck - typecheck

View file

@ -49,14 +49,10 @@ var cmdSubnet = &cobra.Command{
// shared flags of cmdSubnet sub-commands. // shared flags of cmdSubnet sub-commands.
const ( const (
// subnet identifier flagSubnet = "subnet" // subnet identifier
flagSubnet = "subnet" flagSubnetGroup = "group" // subnet client group ID
// subnet client group ID flagSubnetWallet = "wallet" // filepath to wallet
flagSubnetGroup = "group" flagSubnetAddress = "address" // address in the wallet, optional
// filepath to wallet
flagSubnetWallet = "wallet"
// address in the wallet, optional
flagSubnetAddress = "address"
) )
// reads wallet from the filepath configured in flagSubnetWallet flag, // reads wallet from the filepath configured in flagSubnetWallet flag,
@ -171,7 +167,7 @@ var cmdSubnetCreate = &cobra.Command{
// cmdSubnetRemove flags. // cmdSubnetRemove flags.
const ( const (
// subnet ID to be removed // subnet ID to be removed.
flagSubnetRemoveID = flagSubnet flagSubnetRemoveID = flagSubnet
) )
@ -223,7 +219,7 @@ var cmdSubnetRemove = &cobra.Command{
// cmdSubnetGet flags. // cmdSubnetGet flags.
const ( const (
// subnet ID to be read // subnet ID to be read.
flagSubnetGetID = flagSubnet flagSubnetGetID = flagSubnet
) )
@ -286,12 +282,9 @@ var cmdSubnetGet = &cobra.Command{
// cmdSubnetAdmin subnet flags. // cmdSubnetAdmin subnet flags.
const ( const (
// subnet ID to be managed flagSubnetAdminSubnet = flagSubnet // subnet ID to be managed
flagSubnetAdminSubnet = flagSubnet flagSubnetAdminID = "admin" // admin public key
// admin public key flagSubnetAdminClient = "client" // manage client admins instead of node ones
flagSubnetAdminID = "admin"
// manage client admins instead of node ones
flagSubnetAdminClient = "client"
) )
// command to manage subnet admins. // command to manage subnet admins.
@ -310,8 +303,7 @@ var cmdSubnetAdmin = &cobra.Command{
// cmdSubnetAdminAdd flags. // cmdSubnetAdminAdd flags.
const ( const (
// client group ID flagSubnetAdminAddGroup = flagSubnetGroup // client group ID
flagSubnetAdminAddGroup = flagSubnetGroup
) )
// common executor cmdSubnetAdminAdd and cmdSubnetAdminRemove commands. // common executor cmdSubnetAdminAdd and cmdSubnetAdminRemove commands.
@ -433,12 +425,9 @@ var cmdSubnetAdminRemove = &cobra.Command{
// cmdSubnetClient flags. // cmdSubnetClient flags.
const ( const (
// ID of the subnet to be managed flagSubnetClientSubnet = flagSubnet // ID of the subnet to be managed
flagSubnetClientSubnet = flagSubnet flagSubnetClientID = flagSubnetAdminClient // client's NeoFS ID
// client's NeoFS ID flagSubnetClientGroup = flagSubnetGroup // ID of the subnet client group
flagSubnetClientID = flagSubnetAdminClient
// ID of the subnet client group
flagSubnetClientGroup = flagSubnetGroup
) )
// command to manage subnet clients. // command to manage subnet clients.
@ -544,10 +533,8 @@ var cmdSubnetClientRemove = &cobra.Command{
// cmdSubnetNode flags. // cmdSubnetNode flags.
const ( const (
// node ID flagSubnetNode = "node" // node ID
flagSubnetNode = "node" flagSubnetNodeSubnet = flagSubnet // ID of the subnet to be managed
// ID of the subnet to be managed
flagSubnetNodeSubnet = flagSubnet
) )
// common executor cmdSubnetNodeAdd and cmdSubnetNodeRemove commands. // 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) { func PrettyPrintNetMap(cmd *cobra.Command, nm netmap.NetMap) {
cmd.Println("Epoch:", nm.Epoch()) cmd.Println("Epoch:", nm.Epoch())

View file

@ -44,11 +44,11 @@ const (
) )
// Init adds common flags to the command: // Init adds common flags to the command:
// - GenerateKey // - GenerateKey,
// - WalletPath // - WalletPath,
// - Account // - Account,
// - RPC // - RPC,
// - Timeout // - Timeout.
func Init(cmd *cobra.Command) { func Init(cmd *cobra.Command) {
InitWithoutRPC(cmd) InitWithoutRPC(cmd)

View file

@ -6,7 +6,7 @@ import (
"github.com/spf13/viper" "github.com/spf13/viper"
) )
// Cmd represents the accounting command // Cmd represents the accounting command.
var Cmd = &cobra.Command{ var Cmd = &cobra.Command{
Use: "accounting", Use: "accounting",
Short: "Operations with accounts and balances", Short: "Operations with accounts and balances",

View file

@ -146,6 +146,8 @@ func getRulesFromFile(filename string) ([]string, error) {
// //
// Examples: // Examples:
// allow get req:X-Header=123 obj:Attr=value others:0xkey1,key2 system:key3 user:key4 // 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 { func parseTable(tb *eacl.Table, args []string) error {
if len(args) < 2 { if len(args) < 2 {
return errors.New("at least 2 arguments must be provided") return errors.New("at least 2 arguments must be provided")

View file

@ -12,13 +12,13 @@ import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
// flags of list command // flags of list command.
const ( const (
flagListPrintAttr = "with-attr" flagListPrintAttr = "with-attr"
flagListContainerOwner = "owner" flagListContainerOwner = "owner"
) )
// flag vars of list command // flag vars of list command.
var ( var (
flagVarListPrintAttr bool flagVarListPrintAttr bool
flagVarListContainerOwner string flagVarListContainerOwner string

View file

@ -15,12 +15,12 @@ import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
// flags of list-object command // flags of list-object command.
const ( const (
flagListObjectPrintAttr = "with-attr" flagListObjectPrintAttr = "with-attr"
) )
// flag vars of list-objects command // flag vars of list-objects command.
var ( var (
flagVarListObjectsPrintAttr bool flagVarListObjectsPrintAttr bool
) )

View file

@ -5,7 +5,7 @@ import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
// Cmd represents the container command // Cmd represents the container command.
var Cmd = &cobra.Command{ var Cmd = &cobra.Command{
Use: "container", Use: "container",
Short: "Operations with containers", Short: "Operations with containers",

View file

@ -5,7 +5,7 @@ import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
// Cmd represents the object command // Cmd represents the object command.
var Cmd = &cobra.Command{ var Cmd = &cobra.Command{
Use: "object", Use: "object",
Short: "Operations with Objects", Short: "Operations with Objects",

View file

@ -33,7 +33,7 @@ var (
cfgFile string 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{ var rootCmd = &cobra.Command{
Use: "neofs-cli", Use: "neofs-cli",
Short: "Command Line Tool to work with NeoFS", Short: "Command Line Tool to work with NeoFS",

View file

@ -6,7 +6,7 @@ import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
// Cmd represents the storagegroup command // Cmd represents the storagegroup command.
var Cmd = &cobra.Command{ var Cmd = &cobra.Command{
Use: "storagegroup", Use: "storagegroup",
Short: "Operations with Storage Groups", Short: "Operations with Storage Groups",

View file

@ -4,7 +4,7 @@ import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
// locode section // locode section.
var locodeCmd = &cobra.Command{ var locodeCmd = &cobra.Command{
Use: "locode", Use: "locode",
Short: "Working with NeoFS UN/LOCODE database", Short: "Working with NeoFS UN/LOCODE database",

View file

@ -19,10 +19,10 @@ import (
) )
const ( const (
// ErrorReturnCode returns when application crashed at initialization stage // ErrorReturnCode returns when application crashed at initialization stage.
ErrorReturnCode = 1 ErrorReturnCode = 1
// SuccessReturnCode returns when application closed without panic // SuccessReturnCode returns when application closed without panic.
SuccessReturnCode = 0 SuccessReturnCode = 0
) )

View file

@ -364,7 +364,7 @@ type shared struct {
} }
// dynamicConfiguration stores parameters of the // dynamicConfiguration stores parameters of the
// components that supports runtime reconfigurations // components that supports runtime reconfigurations.
type dynamicConfiguration struct { type dynamicConfiguration struct {
logger *logger.Prm logger *logger.Prm
} }

View file

@ -189,7 +189,7 @@ func safeMul(size float64, multiplier uint64) uint64 {
return lo 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 { func parseSizeInBytes(sizeStr string) uint64 {
sizeStr = strings.TrimSpace(sizeStr) sizeStr = strings.TrimSpace(sizeStr)
lastChar := len(sizeStr) - 1 lastChar := len(sizeStr) - 1

View file

@ -60,8 +60,7 @@ func New(_ Prm, opts ...Option) *Config {
} }
} }
// Reload reads configuration path if any was provided // Reload reads configuration path if it was provided to New.
// to the New. Returns any
func (x *Config) Reload() error { func (x *Config) Reload() error {
if x.opts.path != "" { if x.opts.path != "" {
err := x.v.ReadInConfig() err := x.v.ReadInConfig()

View file

@ -10,7 +10,6 @@ import (
// which provides access to Blobovnicza configurations. // which provides access to Blobovnicza configurations.
type Config config.Config type Config config.Config
// config defaults
const ( const (
// SizeDefault is a default limit of estimates of Blobovnicza size. // SizeDefault is a default limit of estimates of Blobovnicza size.
SizeDefault = 1 << 30 SizeDefault = 1 << 30

View file

@ -11,7 +11,6 @@ import (
// which provides access to boltdb specific parameters. // which provides access to boltdb specific parameters.
type Config config.Config type Config config.Config
// config defaults
const ( const (
// PermDefault is a default permission bits for metabase file. // PermDefault is a default permission bits for metabase file.
PermDefault = 0660 PermDefault = 0660

View file

@ -10,7 +10,6 @@ import (
// which provides access to Shard's GC configurations. // which provides access to Shard's GC configurations.
type Config config.Config type Config config.Config
// config defaults
const ( const (
// RemoverBatchSizeDefault is a default batch size for Shard GC's remover. // RemoverBatchSizeDefault is a default batch size for Shard GC's remover.
RemoverBatchSizeDefault = 100 RemoverBatchSizeDefault = 100

View file

@ -9,7 +9,6 @@ import (
// which provides access to WriteCache configurations. // which provides access to WriteCache configurations.
type Config config.Config type Config config.Config
// config defaults
const ( const (
// SmallSizeDefault is a default size of small objects. // SmallSizeDefault is a default size of small objects.
SmallSizeDefault = 32 << 10 SmallSizeDefault = 32 << 10

View file

@ -4,7 +4,6 @@ import (
"github.com/nspcc-dev/neofs-node/cmd/neofs-node/config" "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config"
) )
// config defaults
const ( const (
// LevelDefault is a default logger level. // LevelDefault is a default logger level.
LevelDefault = "info" 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) { func addContainerNotificationHandler(c *cfg, sTyp string, h event.Handler) {
typ := event.TypeFromString(sTyp) 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) 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) { func addContainerAsyncNotificationHandler(c *cfg, sTyp string, h event.Handler) {
addContainerNotificationHandler( addContainerNotificationHandler(
c, c,

View file

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

View file

@ -315,12 +315,12 @@ func (c *cfg) netmapLocalNodeState(epoch uint64) (*netmapSDK.NodeInfo, error) {
return nil, nil 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) { func addNewEpochNotificationHandler(c *cfg, h event.Handler) {
addNetmapNotificationHandler(c, newEpochNotification, h) 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) { func addNewEpochAsyncNotificationHandler(c *cfg, h event.Handler) {
addNetmapNotificationHandler( addNetmapNotificationHandler(
c, c,

View file

@ -52,7 +52,7 @@ const (
lastLetterNum lastLetterNum
) )
// returns string in config-compatible format // String returns l in config-compatible format.
func (l GlagoliticLetter) String() string { func (l GlagoliticLetter) String() string {
switch l { switch l {
default: default:

View file

@ -20,11 +20,11 @@ type (
const ( const (
// gasMultiplier defines how many times more the notary // gasMultiplier defines how many times more the notary
// balance must be compared to the GAS balance of the IR: // balance must be compared to the GAS balance of the IR:
// notaryBalance = GASBalance * gasMultiplier // notaryBalance = GASBalance * gasMultiplier.
gasMultiplier = 3 gasMultiplier = 3
// gasDivisor defines what part of GAS balance (1/gasDivisor) // 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 gasDivisor = 2
) )

View file

@ -14,7 +14,7 @@ import (
) )
type ( type (
// AlphabetState is a callback interface for inner ring global state // AlphabetState is a callback interface for inner ring global state.
AlphabetState interface { AlphabetState interface {
IsAlphabet() bool 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 // 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, // `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) { func updateInnerRing(innerRing, before, after keys.PublicKeys) (keys.PublicKeys, error) {
lnBefore := len(before) lnBefore := len(before)
if lnBefore != len(after) { if lnBefore != len(after) {

View file

@ -20,12 +20,12 @@ import (
) )
type ( type (
// EpochState is a callback interface for inner ring global state // EpochState is a callback interface for inner ring global state.
EpochState interface { EpochState interface {
EpochCounter() uint64 EpochCounter() uint64
} }
// AlphabetState is a callback interface for inner ring global state // AlphabetState is a callback interface for inner ring global state.
AlphabetState interface { AlphabetState interface {
IsAlphabet() bool IsAlphabet() bool
} }

View file

@ -20,7 +20,7 @@ type (
BasicRate() (uint64, error) BasicRate() (uint64, error)
} }
// BalanceFetcher uses NEP-17 compatible balance contract // BalanceFetcher uses NEP-17 compatible balance contract.
BalanceFetcher interface { BalanceFetcher interface {
Balance(id user.ID) (*big.Int, error) Balance(id user.ID) (*big.Int, error)
} }

View file

@ -12,7 +12,7 @@ import (
) )
type ( type (
// AlphabetState is a callback interface for inner ring global state // AlphabetState is a callback interface for inner ring global state.
AlphabetState interface { AlphabetState interface {
IsAlphabet() bool IsAlphabet() bool
} }

View file

@ -85,11 +85,8 @@ func (s *Server) stopSubnet() {
// names of listened notification events from Subnet contract. // names of listened notification events from Subnet contract.
const ( const (
// subnet creation
subnetCreateEvName = "Put" subnetCreateEvName = "Put"
// subnet removal
subnetRemoveEvName = "Delete" subnetRemoveEvName = "Delete"
// subnet creation (notary)
notarySubnetCreateEvName = "put" notarySubnetCreateEvName = "put"
) )

View file

@ -214,7 +214,7 @@ func (rCfg *ReConfiguration) SetErrorsThreshold(errorsThreshold uint32) {
rCfg.errorsThreshold = errorsThreshold 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) { func (rCfg *ReConfiguration) SetShardPoolSize(shardPoolSize uint32) {
rCfg.shardPoolSize = shardPoolSize rCfg.shardPoolSize = shardPoolSize
} }

View file

@ -5,7 +5,7 @@ import (
"go.uber.org/zap" "go.uber.org/zap"
) )
// a distinctive part of all messages // headMsg is a distinctive part of all messages.
const headMsg = "local object storage operation" const headMsg = "local object storage operation"
// Write writes message about storage engine's operation to logger. // 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 // Prefix bytes for database keys. All ids and addresses are encoded in binary
// unless specified otherwise. // unless specified otherwise.
//
//nolint:godot
const ( const (
// graveyardPrefix is used for the graveyard bucket. // graveyardPrefix is used for the graveyard bucket.
// Key: object address // Key: object address

View file

@ -43,11 +43,11 @@ var (
// timestamp in big-endian -> log operation // timestamp in big-endian -> log operation
// //
// tree storage (dataBucket): // tree storage (dataBucket):
// 't' + node (id) -> timestamp when the node first appeared // - 't' + node (id) -> timestamp when the node first appeared,
// 'p' + node (id) -> parent (id) // - 'p' + node (id) -> parent (id),
// 'm' + node (id) -> serialized meta // - 'm' + node (id) -> serialized meta,
// 'c' + parent (id) + child (id) -> 0/1 // - 'c' + parent (id) + child (id) -> 0/1,
// 'i' + 0 + attrKey + 0 + attrValue + 0 + parent (id) + node (id) -> 0/1 (1 for automatically created nodes) // - 'i' + 0 + attrKey + 0 + attrValue + 0 + parent (id) + node (id) -> 0/1 (1 for automatically created nodes).
func NewBoltForest(opts ...Option) ForestStorage { func NewBoltForest(opts ...Option) ForestStorage {
b := boltForest{ b := boltForest{
cfg: cfg{ cfg: cfg{
@ -660,28 +660,28 @@ func bucketName(cid cidSDK.ID, treeID string) []byte {
return []byte(cid.String() + treeID) 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 { func timestampKey(key []byte, child Node) []byte {
key[0] = 't' key[0] = 't'
binary.LittleEndian.PutUint64(key[1:], child) binary.LittleEndian.PutUint64(key[1:], child)
return key[:9] return key[:9]
} }
// 'p' + node (id) -> parent (id) // 'p' + node (id) -> parent (id).
func parentKey(key []byte, child Node) []byte { func parentKey(key []byte, child Node) []byte {
key[0] = 'p' key[0] = 'p'
binary.LittleEndian.PutUint64(key[1:], child) binary.LittleEndian.PutUint64(key[1:], child)
return key[:9] return key[:9]
} }
// 'm' + node (id) -> serialized meta // 'm' + node (id) -> serialized meta.
func metaKey(key []byte, child Node) []byte { func metaKey(key []byte, child Node) []byte {
key[0] = 'm' key[0] = 'm'
binary.LittleEndian.PutUint64(key[1:], child) binary.LittleEndian.PutUint64(key[1:], child)
return key[:9] 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 { func childrenKey(key []byte, child, parent Node) []byte {
key[0] = 'c' key[0] = 'c'
binary.LittleEndian.PutUint64(key[1:], parent) binary.LittleEndian.PutUint64(key[1:], parent)
@ -689,7 +689,7 @@ func childrenKey(key []byte, child, parent Node) []byte {
return key[:17] 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 { func internalKey(key []byte, k, v string, parent, node Node) []byte {
size := 1 /* prefix */ + 2*2 /* len */ + 2*8 /* nodes */ + len(k) + len(v) size := 1 /* prefix */ + 2*2 /* len */ + 2*8 /* nodes */ + len(k) + len(v)
if cap(key) < size { if cap(key) < size {

View file

@ -296,12 +296,12 @@ func (s *Shard) fillInfo() {
const ( const (
// physical is a physically stored object // physical is a physically stored object
// counter type // counter type.
physical = "phy" physical = "phy"
// logical is a logically stored object // logical is a logically stored object
// counter type (excludes objects that are // counter type (excludes objects that are
// stored but unavailable) // stored but unavailable).
logical = "logic" logical = "logic"
) )

View file

@ -24,7 +24,7 @@ func (b *BurnPrm) SetAmount(amount int64) {
b.amount = amount b.amount = amount
} }
// SetID sets ID // SetID sets ID.
func (b *BurnPrm) SetID(id []byte) { func (b *BurnPrm) SetID(id []byte) {
b.id = id b.id = id
} }

View file

@ -214,7 +214,7 @@ func (c *Client) TestInvoke(contract util.Uint160, method string, args ...interf
return val.Stack, nil 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 { func (c *Client) TransferGas(receiver util.Uint160, amount fixedn.Fixed8) error {
c.switchLock.RLock() c.switchLock.RLock()
defer c.switchLock.RUnlock() 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() { func (c *Client) close() {
close(c.notifications) close(c.notifications)
c.client.Close() c.client.Close()

View file

@ -45,8 +45,7 @@ type deltaCfg struct {
pulse bool pulse bool
} }
// WithPulse returns option to call delta-interval handler multiple // WithPulse returns option to call delta-interval handler multiple times.
// times
func WithPulse() DeltaOption { func WithPulse() DeltaOption {
return func(c *deltaCfg) { return func(c *deltaCfg) {
c.pulse = true c.pulse = true

View file

@ -86,7 +86,7 @@ func (a *Address) FromString(s string) error {
return err 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) { func multiaddrStringFromHostAddr(host string) (string, error) {
endpoint, port, err := net.SplitHostPort(host) endpoint, port, err := net.SplitHostPort(host)
if err != nil { if err != nil {

View file

@ -8,7 +8,7 @@ import (
const ( const (
// maxProtocolsAmount is maximal amount of protocols // maxProtocolsAmount is maximal amount of protocols
// in multiaddress after parsing with network.AddressFromString // in multiaddress after parsing with network.AddressFromString.
maxProtocolsAmount = 3 maxProtocolsAmount = 3
// minProtocolsAmount is minimal amount of protocols // minProtocolsAmount is minimal amount of protocols
@ -16,10 +16,10 @@ const (
// host(ip) and port. // host(ip) and port.
minProtocolsAmount = 2 minProtocolsAmount = 2
// network protocols // network protocols.
dns, ip4, ip6 = "dns4", "ip4", "ip6" dns, ip4, ip6 = "dns4", "ip4", "ip6"
// transport protocols // transport protocols.
tcp = "tcp" tcp = "tcp"
) )

View file

@ -6,7 +6,7 @@ import (
"github.com/nspcc-dev/neofs-api-go/v2/accounting" "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 { type Server interface {
Balance(context.Context, *accounting.BalanceRequest) (*accounting.BalanceResponse, error) 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. // Panics if at least one value of the parameters is invalid.
// //
// The created Controller does not require additional // 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 { func New(prm Prm, opts ...Option) *Controller {
switch { switch {
case prm.LocalMetrics == nil: case prm.LocalMetrics == nil:

View file

@ -6,7 +6,7 @@ import (
"github.com/nspcc-dev/neofs-api-go/v2/container" "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 { type Server interface {
Put(context.Context, *container.PutRequest) (*container.PutResponse, error) Put(context.Context, *container.PutRequest) (*container.PutResponse, error)
Get(context.Context, *container.GetRequest) (*container.GetResponse, 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" "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 { type Server interface {
LocalNodeInfo(context.Context, *netmap.LocalNodeInfoRequest) (*netmap.LocalNodeInfoResponse, error) LocalNodeInfo(context.Context, *netmap.LocalNodeInfoRequest) (*netmap.LocalNodeInfoResponse, error)
NetworkInfo(context.Context, *netmap.NetworkInfoRequest) (*netmap.NetworkInfoResponse, 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 writtenPayload uint64 // number of already written payload bytes
} }
// errors related to invalid payload size
var ( 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") 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") ErrWrongPayloadSize = errors.New("wrong payload size")
) )

View file

@ -15,7 +15,7 @@ import (
"go.uber.org/zap" "go.uber.org/zap"
) )
// tracks Policer's check progress // tracks Policer's check progress.
type nodeCache map[uint64]bool type nodeCache map[uint64]bool
func newNodeCache() *nodeCache { 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 type nodeServer apiNetmap.NodeInfo
func (x nodeServer) PublicKey() []byte { 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. // Panics if at least one value of the parameters is invalid.
// //
// The created Controller does not require additional // 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 { func New(prm Prm, opts ...Option) *Controller {
switch { switch {
case prm.LocalTrustSource == nil: case prm.LocalTrustSource == nil:

View file

@ -6,7 +6,7 @@ import (
"github.com/nspcc-dev/neofs-api-go/v2/session" "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 { type Server interface {
Create(context.Context, *session.CreateRequest) (*session.CreateResponse, error) 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 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) { func minutesToDegrees(raw []byte) (float64, error) {
minutes, err := strconv.ParseFloat(string(raw), 64) minutes, err := strconv.ParseFloat(string(raw), 64)
if err != nil { if err != nil {