[#1687] *: Perform go fmt using go v1.19

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
Pavel Karpy 2022-08-15 19:20:20 +03:00 committed by Pavel Karpy
parent 37ab26bfa9
commit 30341f2192
25 changed files with 89 additions and 87 deletions

View file

@ -5,8 +5,8 @@
// the NeoFS CLI application does not fully use the client's flexible interface. // the NeoFS CLI application does not fully use the client's flexible interface.
// //
// In this regard, this package provides functions over base API client necessary for the application. // In this regard, this package provides functions over base API client necessary for the application.
// This allows you to concentrate the entire spectrum of the client's use in one place (this will be convenient // This allows you to concentrate the entire spectrum of the client's use in one place (this will be convenient
// both when updating the base client and for evaluating the UX of SDK library). So it is expected that all // both when updating the base client and for evaluating the UX of SDK library). So it is expected that all
// application packages will be limited to this package for the development of functionality requiring // application packages will be limited to this package for the development of functionality requiring
// NeoFS API communication. // NeoFS API communication.
package internal package internal

View file

@ -33,8 +33,8 @@ func forEachFile(paths []string, f func(*config.Config)) {
} }
// ForEachFileType passes configs read from next files: // ForEachFileType passes configs read from next files:
// - `<pref>.yaml`; // - `<pref>.yaml`;
// - `<pref>.json`. // - `<pref>.json`.
func ForEachFileType(pref string, f func(*config.Config)) { func ForEachFileType(pref string, f func(*config.Config)) {
forEachFile([]string{ forEachFile([]string{
pref + ".yaml", pref + ".yaml",

View file

@ -35,17 +35,17 @@ type signatureVerificationData struct {
} }
// verifySignature is a common method of Container service authentication. Asserts that: // verifySignature is a common method of Container service authentication. Asserts that:
// - for trusted parties: session is valid (*) and issued by container owner // - for trusted parties: session is valid (*) and issued by container owner
// - operation data is signed by container owner or trusted party // - operation data is signed by container owner or trusted party
// - operation data signature is correct // - operation data signature is correct
// //
// (*) includes: // (*) includes:
// - session token decodes correctly // - session token decodes correctly
// - signature is valid // - signature is valid
// - session issued by the container owner // - session issued by the container owner
// - v.binPublicKey is a public session key // - v.binPublicKey is a public session key
// - session context corresponds to the container and verb in v // - session context corresponds to the container and verb in v
// - session is "alive" // - session is "alive"
func (cp *Processor) verifySignature(v signatureVerificationData) error { func (cp *Processor) verifySignature(v signatureVerificationData) error {
var err error var err error
var key neofsecdsa.PublicKeyRFC6979 var key neofsecdsa.PublicKeyRFC6979

View file

@ -70,9 +70,9 @@ func (c *cleanupTable) update(snapshot netmap.NetMap, now uint64) {
// updates last access time of the netmap node by string public key. // updates last access time of the netmap node by string public key.
// //
// Returns true if at least one condition is met: // Returns true if at least one condition is met:
// * node hasn't been accessed yet; // - node hasn't been accessed yet;
// * remove flag is set; // - remove flag is set;
// * binary node info has changed. // - binary node info has changed.
func (c *cleanupTable) touch(keyString string, now uint64, binNodeInfo []byte) bool { func (c *cleanupTable) touch(keyString string, now uint64, binNodeInfo []byte) bool {
c.Lock() c.Lock()
defer c.Unlock() defer c.Unlock()

View file

@ -21,12 +21,12 @@ var errMissingRequiredAttr = errors.New("missing required attribute in DB record
// //
// New attributes are formed from the record of DB instance (Prm). // New attributes are formed from the record of DB instance (Prm).
// If DB entry R was found w/o errors, new attributes are: // If DB entry R was found w/o errors, new attributes are:
// * CountryCode: R.CountryCode().String(); // - CountryCode: R.CountryCode().String();
// * Country: R.CountryName(); // - Country: R.CountryName();
// * Location: Record.LocationName(); // - Location: Record.LocationName();
// * SubDivCode: R.SubDivCode(); // - SubDivCode: R.SubDivCode();
// * SubDiv: R.SubDivName(); // - SubDiv: R.SubDivName();
// * Continent: R.Continent().String(). // - Continent: R.Continent().String().
// //
// UN-LOCODE attribute remains untouched. // UN-LOCODE attribute remains untouched.
func (v *Validator) VerifyAndUpdate(n *netmap.NodeInfo) error { func (v *Validator) VerifyAndUpdate(n *netmap.NodeInfo) error {

View file

@ -37,9 +37,9 @@ var errDiffID = errors.New("diff subnet IDs")
// All read errors of Put are forwarded. // All read errors of Put are forwarded.
// //
// It returns an error on: // It returns an error on:
// * zero subnet creation; // - zero subnet creation;
// * empty ID or different from the one wired into info; // - empty ID or different from the one wired into info;
// * empty owner ID or different from the one wired into info. // - empty owner ID or different from the one wired into info.
func (x PutValidator) Assert(event Put) error { func (x PutValidator) Assert(event Put) error {
var err error var err error

View file

@ -101,12 +101,12 @@ const (
// All handlers are executed only if the local node is an alphabet one. // All handlers are executed only if the local node is an alphabet one.
// //
// Events (notary): // Events (notary):
// * put (parser: subnetevents.ParseNotaryPut, handler: catchSubnetCreation); // - put (parser: subnetevents.ParseNotaryPut, handler: catchSubnetCreation);
// * Delete (parser: subnetevents.ParseDelete, handler: catchSubnetCreation). // - Delete (parser: subnetevents.ParseDelete, handler: catchSubnetCreation).
// //
// Events (non-notary): // Events (non-notary):
// * Put (parser: subnetevents.ParsePut, handler: catchSubnetCreation); // - Put (parser: subnetevents.ParsePut, handler: catchSubnetCreation);
// * Delete (parser: subnetevents.ParseDelete, handler: catchSubnetCreation). // - Delete (parser: subnetevents.ParseDelete, handler: catchSubnetCreation).
func (s *Server) listenSubnet() { func (s *Server) listenSubnet() {
if s.sideNotaryConfig.disabled { if s.sideNotaryConfig.disabled {
s.listenSubnetWithoutNotary() s.listenSubnetWithoutNotary()

View file

@ -141,9 +141,9 @@ func (e *StorageEngine) execIfNotBlocked(op func() error) error {
} }
// sets the flag of blocking execution of all data operations according to err: // sets the flag of blocking execution of all data operations according to err:
// * err != nil, then blocks the execution. If exec wasn't blocked, calls close method // - err != nil, then blocks the execution. If exec wasn't blocked, calls close method
// (if err == errClosed => additionally releases pools and does not allow to resume executions). // (if err == errClosed => additionally releases pools and does not allow to resume executions).
// * otherwise, resumes execution. If exec was blocked, calls open method. // - otherwise, resumes execution. If exec was blocked, calls open method.
// //
// Can be called concurrently with exec. In this case it waits for all executions to complete. // Can be called concurrently with exec. In this case it waits for all executions to complete.
func (e *StorageEngine) setBlockExecErr(err error) error { func (e *StorageEngine) setBlockExecErr(err error) error {

View file

@ -110,10 +110,10 @@ func (e *StorageEngine) inhume(prm InhumePrm) (InhumeRes, error) {
} }
// Returns: // Returns:
// 0 - fail // - 0: fail
// 1 - object locked // - 1: object locked
// 2 - lock object removal // - 2: lock object removal
// 3 - ok // - 3: ok
func (e *StorageEngine) inhumeAddr(addr oid.Address, prm shard.InhumePrm, checkExists bool) (status uint8) { func (e *StorageEngine) inhumeAddr(addr oid.Address, prm shard.InhumePrm, checkExists bool) (status uint8) {
root := false root := false
var errLocked apistatus.ObjectLocked var errLocked apistatus.ObjectLocked

View file

@ -43,9 +43,9 @@ func (e *StorageEngine) lock(idCnr cid.ID, locker oid.ID, locked []oid.ID) error
} }
// Returns: // Returns:
// 0 - fail // - 0: fail
// 1 - locking irregular object // - 1: locking irregular object
// 2 - ok // - 2: ok
func (e *StorageEngine) lockSingle(idCnr cid.ID, locker, locked oid.ID, checkExists bool) (status uint8) { func (e *StorageEngine) lockSingle(idCnr cid.ID, locker, locked oid.ID, checkExists bool) (status uint8) {
// code is pretty similar to inhumeAddr, maybe unify? // code is pretty similar to inhumeAddr, maybe unify?
root := false root := false

View file

@ -95,10 +95,10 @@ func (db *DB) exists(tx *bbolt.Tx, addr oid.Address, currEpoch uint64) (exists b
} }
// objectStatus returns: // objectStatus returns:
// * 0 if object is available; // - 0 if object is available;
// * 1 if object with GC mark; // - 1 if object with GC mark;
// * 2 if object is covered with tombstone; // - 2 if object is covered with tombstone;
// * 3 if object is expired. // - 3 if object is expired.
func objectStatus(tx *bbolt.Tx, addr oid.Address, currEpoch uint64) uint8 { func objectStatus(tx *bbolt.Tx, addr oid.Address, currEpoch uint64) uint8 {
// we check only if the object is expired in the current // we check only if the object is expired in the current
// epoch since it is considered the only corner case: the // epoch since it is considered the only corner case: the

View file

@ -236,8 +236,8 @@ func WithRefillMetabase(v bool) Option {
} }
// WithMode returns option to set shard's mode. Mode must be one of the predefined: // WithMode returns option to set shard's mode. Mode must be one of the predefined:
// - mode.ReadWrite; // - mode.ReadWrite;
// - mode.ReadOnly. // - mode.ReadOnly.
func WithMode(v mode.Mode) Option { func WithMode(v mode.Mode) Option {
return func(c *cfg) { return func(c *cfg) {
c.info.Mode = v c.info.Mode = v

View file

@ -8,11 +8,11 @@
// 3. Main storage (blobstor). // 3. Main storage (blobstor).
// //
// There are 2 types of background jobs: // There are 2 types of background jobs:
// 1. Persisting objects from in-memory cache to database. // 1. Persisting objects from in-memory cache to database.
// 2. Flushing objects from database to blobstor. // 2. Flushing objects from database to blobstor.
// On flushing object address is put in in-memory LRU cache. // On flushing object address is put in in-memory LRU cache.
// The actual deletion from the DB is done when object // The actual deletion from the DB is done when object
// is evicted from this cache. // is evicted from this cache.
// //
// Putting objects to the main storage is done by multiple workers. // Putting objects to the main storage is done by multiple workers.
// Some of them prioritize flushing items, others prioritize putting new objects. // Some of them prioritize flushing items, others prioritize putting new objects.

View file

@ -67,12 +67,12 @@ func defaultConfig() *cfg {
// If private key is nil, it panics. // If private key is nil, it panics.
// //
// Other values are set according to provided options, or by default: // Other values are set according to provided options, or by default:
// * client context: Background; // - client context: Background;
// * dial timeout: 5s; // - dial timeout: 5s;
// * blockchain network type: netmode.PrivNet; // - blockchain network type: netmode.PrivNet;
// * signer with the global scope; // - signer with the global scope;
// * wait interval: 500ms; // - wait interval: 500ms;
// * logger: zap.L(). // - logger: zap.L().
// //
// If desired option satisfies the default value, it can be omitted. // If desired option satisfies the default value, it can be omitted.
// If multiple options of the same config value are supplied, // If multiple options of the same config value are supplied,

View file

@ -820,11 +820,13 @@ func alreadyOnChainError(err error) bool {
// CalculateNotaryDepositAmount calculates notary deposit amount // CalculateNotaryDepositAmount calculates notary deposit amount
// using the rule: // using the rule:
// IF notaryBalance < gasBalance * gasMul { //
// DEPOSIT gasBalance / gasDiv // IF notaryBalance < gasBalance * gasMul {
// } ELSE { // DEPOSIT gasBalance / gasDiv
// DEPOSIT 1 // } ELSE {
// } // DEPOSIT 1
// }
//
// gasMul and gasDiv must be positive. // gasMul and gasDiv must be positive.
func CalculateNotaryDepositAmount(c *Client, gasMul, gasDiv int64) (fixedn.Fixed8, error) { func CalculateNotaryDepositAmount(c *Client, gasMul, gasDiv int64) (fixedn.Fixed8, error) {
notaryBalance, err := c.GetNotaryDeposit() notaryBalance, err := c.GetNotaryDeposit()

View file

@ -108,8 +108,8 @@ func (i *InvokePrmOptional) SetHash(hash util.Uint256) {
// Supported args types are the same as in Client. // Supported args types are the same as in Client.
// //
// If TryNotary is provided: // If TryNotary is provided:
// - if AsAlphabet is provided, calls NotaryInvoke; // - if AsAlphabet is provided, calls NotaryInvoke;
// - otherwise, calls NotaryInvokeNotAlpha. // - otherwise, calls NotaryInvokeNotAlpha.
// //
// If fee for the operation executed using specified method is customized, then StaticClient uses it. // If fee for the operation executed using specified method is customized, then StaticClient uses it.
// Otherwise, default fee is used. // Otherwise, default fee is used.

View file

@ -52,11 +52,9 @@ func (x NodeEndpointsIterator) NumberOfAddresses() int {
// //
// Correct composition(and order from low to high level) // Correct composition(and order from low to high level)
// of protocols: // of protocols:
// // 1. dns4/ip4/ip6
// 1. dns4/ip4/ip6 // 2. tcp
// 2. tcp // 3. tls(optional, may be absent)
// 3. tls(optional, may be absent)
//
func VerifyMultiAddress(ni netmap.NodeInfo) error { func VerifyMultiAddress(ni netmap.NodeInfo) error {
return iterateParsedAddresses(NodeEndpointsIterator(ni), checkProtocols) return iterateParsedAddresses(NodeEndpointsIterator(ni), checkProtocols)
} }

View file

@ -23,8 +23,8 @@ func panicOnPrmValue(n string, v interface{}) {
// New creates a new instance of the Server. // New creates a new instance of the Server.
// //
// Panics if: // Panics if:
// - parameterized private key is nil; // - parameterized private key is nil;
// - parameterized HealthChecker is nil. // - parameterized HealthChecker is nil.
// //
// Forms white list from all keys specified via // Forms white list from all keys specified via
// WithAllowedKeys option and a public key of // WithAllowedKeys option and a public key of

Binary file not shown.

View file

@ -129,8 +129,8 @@ func (x GetObjectRes) Object() *object.Object {
// //
// Returns any error which prevented the operation from completing correctly in error return. // Returns any error which prevented the operation from completing correctly in error return.
// Returns: // Returns:
// error of type *object.SplitInfoError if object raw flag is set and requested object is virtual; // - error of type *object.SplitInfoError if object raw flag is set and requested object is virtual;
// error of type *apistatus.ObjectAlreadyRemoved if the requested object is marked to be removed. // - error of type *apistatus.ObjectAlreadyRemoved if the requested object is marked to be removed.
func GetObject(prm GetObjectPrm) (*GetObjectRes, error) { func GetObject(prm GetObjectPrm) (*GetObjectRes, error) {
if prm.tokenSession != nil { if prm.tokenSession != nil {
prm.cliPrm.WithinSession(*prm.tokenSession) prm.cliPrm.WithinSession(*prm.tokenSession)
@ -219,8 +219,9 @@ func (x HeadObjectRes) Header() *object.Object {
// //
// Returns any error which prevented the operation from completing correctly in error return. // Returns any error which prevented the operation from completing correctly in error return.
// Returns: // Returns:
// error of type *object.SplitInfoError if object raw flag is set and requested object is virtual; //
// error of type *apistatus.ObjectAlreadyRemoved if the requested object is marked to be removed. // error of type *object.SplitInfoError if object raw flag is set and requested object is virtual;
// error of type *apistatus.ObjectAlreadyRemoved if the requested object is marked to be removed.
func HeadObject(prm HeadObjectPrm) (*HeadObjectRes, error) { func HeadObject(prm HeadObjectPrm) (*HeadObjectRes, error) {
if prm.local { if prm.local {
prm.cliPrm.MarkLocal() prm.cliPrm.MarkLocal()
@ -305,8 +306,9 @@ func (x PayloadRangeRes) PayloadRange() []byte {
// //
// Returns any error which prevented the operation from completing correctly in error return. // Returns any error which prevented the operation from completing correctly in error return.
// Returns: // Returns:
// error of type *object.SplitInfoError if object raw flag is set and requested object is virtual; //
// error of type *apistatus.ObjectAlreadyRemoved if the requested object is marked to be removed. // error of type *object.SplitInfoError if object raw flag is set and requested object is virtual;
// error of type *apistatus.ObjectAlreadyRemoved if the requested object is marked to be removed.
func PayloadRange(prm PayloadRangePrm) (*PayloadRangeRes, error) { func PayloadRange(prm PayloadRangePrm) (*PayloadRangeRes, error) {
if prm.local { if prm.local {
prm.cliPrm.MarkLocal() prm.cliPrm.MarkLocal()

View file

@ -39,8 +39,8 @@ type ExpirationChecker struct {
// IsTombstoneAvailable checks the tombstone presence in the system in the // IsTombstoneAvailable checks the tombstone presence in the system in the
// following order: // following order:
// * 1. Local LRU cache; // - 1. Local LRU cache;
// * 2. Tombstone source. // - 2. Tombstone source.
// //
// If a tombstone was successfully fetched (regardless of its expiration) // If a tombstone was successfully fetched (regardless of its expiration)
// it is cached in the LRU cache. // it is cached in the LRU cache.

View file

@ -30,8 +30,8 @@ type Prm struct {
// //
// Controller's main goal is to separate the two main stages of // Controller's main goal is to separate the two main stages of
// the calculation: // the calculation:
// 1.reporting local values to manager nodes // 1. reporting local values to manager nodes
// 2.calculating global trusts of child nodes // 2. calculating global trusts of child nodes
// //
// Calculation stages are controlled based on external signals // Calculation stages are controlled based on external signals
// that come from the application through the Controller's API. // that come from the application through the Controller's API.

View file

@ -231,8 +231,8 @@ func setStatusV2(resp ResponseMessage, err error) {
// signs response with private key via signature.SignServiceMessage. // signs response with private key via signature.SignServiceMessage.
// The signature error affects the result depending on the protocol version: // The signature error affects the result depending on the protocol version:
// * if status return is supported, panics since we cannot return the failed status, because it will not be signed; // - if status return is supported, panics since we cannot return the failed status, because it will not be signed;
// * otherwise, returns error in order to transport it directly. // - otherwise, returns error in order to transport it directly.
func signResponse(key *ecdsa.PrivateKey, resp interface{}, statusSupported bool) error { func signResponse(key *ecdsa.PrivateKey, resp interface{}, statusSupported bool) error {
err := signature.SignServiceMessage(key, resp) err := signature.SignServiceMessage(key, resp)
if err != nil { if err != nil {

View file

@ -54,7 +54,7 @@ func panicOnValue(t, 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.
// //
// Panics if at least one of next optional parameters is invalid: // Panics if at least one of next optional parameters is invalid:
// * shutdown timeout is non-positive. // - shutdown timeout is non-positive.
// //
// The created Server does not require additional // The created Server does not require additional
// initialization and is completely ready for work. // initialization and is completely ready for work.

View file

@ -34,9 +34,9 @@ func (p *Prm) SetLevelString(s string) error {
// NewLogger constructs a new zap logger instance. // NewLogger constructs a new zap logger instance.
// //
// Logger is built from production logging configuration with: // Logger is built from production logging configuration with:
// * parameterized level; // - parameterized level;
// * console encoding; // - console encoding;
// * ISO8601 time encoding. // - ISO8601 time encoding.
// //
// Logger records a stack trace for all messages at or above fatal level. // Logger records a stack trace for all messages at or above fatal level.
func NewLogger(prm Prm) (*Logger, error) { func NewLogger(prm Prm) (*Logger, error) {