[#66] node: Replace interface{} with any #69

Merged
ale64bit merged 1 commit from misc/66-interface_to_any into master 2023-02-21 13:47:08 +00:00
67 changed files with 135 additions and 135 deletions

View file

@ -140,7 +140,7 @@ func setConfigCmd(cmd *cobra.Command, args []string) error {
return wCtx.awaitTx()
}
func parseConfigPair(kvStr string, force bool) (key string, val interface{}, err error) {
func parseConfigPair(kvStr string, force bool) (key string, val any, err error) {
kv := strings.SplitN(kvStr, "=", 2)
if len(kv) != 2 {
return "", nil, fmt.Errorf("invalid parameter format: must be 'key=val', got: %s", kvStr)

View file

@ -167,7 +167,7 @@ func (c *initializeContext) updateContracts() error {
w := io2.NewBufBinWriter()
var keysParam []interface{}
var keysParam []any
// Update script size for a single-node committee is close to the maximum allowed size of 65535.
// Because of this we want to reuse alphabet contract NEF and manifest for different updates.
@ -299,7 +299,7 @@ func (c *initializeContext) updateContracts() error {
func (c *initializeContext) deployContracts() error {
alphaCs := c.getContract(alphabetContract)
var keysParam []interface{}
var keysParam []any
baseGroups := alphaCs.Manifest.Groups
@ -510,12 +510,12 @@ func readContractsFromArchive(file io.Reader, names []string) (map[string]*contr
return m, nil
}
func getContractDeployParameters(cs *contractState, deployData []interface{}) []interface{} {
return []interface{}{cs.RawNEF, cs.RawManifest, deployData}
func getContractDeployParameters(cs *contractState, deployData []any) []any {
return []any{cs.RawNEF, cs.RawManifest, deployData}
}
func (c *initializeContext) getContractDeployData(ctrName string, keysParam []interface{}) []interface{} {
items := make([]interface{}, 1, 6)
func (c *initializeContext) getContractDeployData(ctrName string, keysParam []any) []any {
items := make([]any, 1, 6)
items[0] = false // notaryDisabled is false
switch ctrName {
@ -551,7 +551,7 @@ func (c *initializeContext) getContractDeployData(ctrName string, keysParam []in
c.Contracts[netmapContract].Hash,
c.Contracts[containerContract].Hash)
case netmapContract:
configParam := []interface{}{
configParam := []any{
netmapEpochKey, viper.GetInt64(epochDurationInitFlag),
netmapMaxObjectSizeKey, viper.GetInt64(maxObjectSizeInitFlag),
netmapAuditFeeKey, viper.GetInt64(auditFeeInitFlag),
@ -580,8 +580,8 @@ func (c *initializeContext) getContractDeployData(ctrName string, keysParam []in
return items
}
func (c *initializeContext) getAlphabetDeployItems(i, n int) []interface{} {
items := make([]interface{}, 6)
func (c *initializeContext) getAlphabetDeployItems(i, n int) []any {
items := make([]any, 6)
items[0] = false
items[1] = c.Contracts[netmapContract].Hash
items[2] = c.Contracts[proxyContract].Hash

View file

@ -281,7 +281,7 @@ func nnsIsAvailable(c Client, nnsHash util.Uint160, name string) (bool, error) {
case *rpcclient.Client:
return ct.NNSIsAvailable(nnsHash, name)
default:
b, err := unwrap.Bool(invokeFunction(c, nnsHash, "isAvailable", []interface{}{name}, nil))
b, err := unwrap.Bool(invokeFunction(c, nnsHash, "isAvailable", []any{name}, nil))
if err != nil {
return false, fmt.Errorf("`isAvailable`: invalid response: %w", err)
}

View file

@ -16,7 +16,7 @@ func (c *initializeContext) setNotaryAndAlphabetNodes() error {
return err
}
var pubs []interface{}
var pubs []any
for _, acc := range c.Accounts {
pubs = append(pubs, acc.PrivateKey().PublicKey().Bytes())
}

View file

@ -190,7 +190,7 @@ func (l *localClient) GetCommittee() (keys.PublicKeys, error) {
func (l *localClient) InvokeFunction(h util.Uint160, method string, sPrm []smartcontract.Parameter, ss []transaction.Signer) (*result.Invoke, error) {
var err error
pp := make([]interface{}, len(sPrm))
pp := make([]any, len(sPrm))
for i, p := range sPrm {
pp[i], err = smartcontract.ExpandParameterToEmitable(p)
if err != nil {
@ -346,7 +346,7 @@ func getSigners(sender *wallet.Account, cosigners []rpcclient.SignerAccount) ([]
}
func (l *localClient) NEP17BalanceOf(h util.Uint160, acc util.Uint160) (int64, error) {
res, err := invokeFunction(l, h, "balanceOf", []interface{}{acc}, nil)
res, err := invokeFunction(l, h, "balanceOf", []any{acc}, nil)
if err != nil {
return 0, err
}
@ -451,7 +451,7 @@ func (l *localClient) putTransactions() error {
return l.bc.AddBlock(b)
}
func invokeFunction(c Client, h util.Uint160, method string, parameters []interface{}, signers []transaction.Signer) (*result.Invoke, error) {
func invokeFunction(c Client, h util.Uint160, method string, parameters []any, signers []transaction.Signer) (*result.Invoke, error) {
w := io.NewBufBinWriter()
emit.Array(w.BinWriter, parameters...)
emit.AppCallNoArgs(w.BinWriter, h, method, callflag.All)

View file

@ -111,7 +111,7 @@ func depositNotary(cmd *cobra.Command, _ []string) error {
accHash,
notary.Hash,
big.NewInt(int64(gasAmount)),
[]interface{}{nil, int64(height) + till},
[]any{nil, int64(height) + till},
)
if err != nil {
return fmt.Errorf("could not send tx: %w", err)

View file

@ -340,7 +340,7 @@ func manageSubnetAdmins(cmd *cobra.Command, rm bool) error {
}
// prepare call parameters
prm := make([]interface{}, 0, 3)
prm := make([]any, 0, 3)
prm = append(prm, id.Marshal())
var method string
@ -742,7 +742,7 @@ func init() {
)
}
func testInvokeMethod(key keys.PrivateKey, method string, args ...interface{}) ([]stackitem.Item, error) {
func testInvokeMethod(key keys.PrivateKey, method string, args ...any) ([]stackitem.Item, error) {
c, err := getN3Client(viper.GetViper())
if err != nil {
return nil, fmt.Errorf("morph client creation: %w", err)
@ -780,7 +780,7 @@ func testInvokeMethod(key keys.PrivateKey, method string, args ...interface{}) (
return res.Stack, nil
}
func invokeMethod(key keys.PrivateKey, tryNotary bool, method string, args ...interface{}) error {
func invokeMethod(key keys.PrivateKey, tryNotary bool, method string, args ...any) error {
c, err := getN3Client(viper.GetViper())
if err != nil {
return fmt.Errorf("morph client creation: %w", err)
@ -821,7 +821,7 @@ func invokeMethod(key keys.PrivateKey, tryNotary bool, method string, args ...in
return nil
}
func invokeNonNotary(c Client, key keys.PrivateKey, method string, args ...interface{}) error {
func invokeNonNotary(c Client, key keys.PrivateKey, method string, args ...any) error {
nnsCs, err := c.GetContractStateByID(1)
if err != nil {
return fmt.Errorf("NNS contract resolving: %w", err)
@ -868,7 +868,7 @@ func invokeNonNotary(c Client, key keys.PrivateKey, method string, args ...inter
return nil
}
func invokeNotary(c Client, key keys.PrivateKey, method string, notaryHash util.Uint160, args ...interface{}) error {
func invokeNotary(c Client, key keys.PrivateKey, method string, notaryHash util.Uint160, args ...any) error {
nnsCs, err := c.GetContractStateByID(1)
if err != nil {
return fmt.Errorf("NNS contract resolving: %w", err)

View file

@ -12,7 +12,7 @@ import (
)
// PrintVerbose prints to the stdout if the commonflags.Verbose flag is on.
func PrintVerbose(cmd *cobra.Command, format string, a ...interface{}) {
func PrintVerbose(cmd *cobra.Command, format string, a ...any) {
if viper.GetBool(commonflags.Verbose) {
cmd.Printf(format+"\n", a...)
}

View file

@ -58,9 +58,9 @@ func listShards(cmd *cobra.Command, _ []string) {
}
func prettyPrintShardsJSON(cmd *cobra.Command, ii []*control.ShardInfo) {
out := make([]map[string]interface{}, 0, len(ii))
out := make([]map[string]any, 0, len(ii))
for _, i := range ii {
out = append(out, map[string]interface{}{
out = append(out, map[string]any{
"shard_id": base58.Encode(i.Shard_ID),
"mode": shardModeToString(i.GetMode()),
"metabase": i.GetMetabasePath(),

View file

@ -127,7 +127,7 @@ type sgHeadReceiver struct {
prm internalclient.HeadObjectPrm
}
func (c sgHeadReceiver) Head(addr oid.Address) (interface{}, error) {
func (c sgHeadReceiver) Head(addr oid.Address) (any, error) {
c.prm.SetAddress(addr)
res, err := internalclient.HeadObject(c.prm)

View file

@ -37,7 +37,7 @@ func (x *Config) Sub(name string) *Config {
// recommended.
//
// Returns nil if config is nil.
func (x *Config) Value(name string) interface{} {
func (x *Config) Value(name string) any {
value := x.v.Get(strings.Join(append(x.path, name), separator))
if value != nil || x.defaultPath == nil {
return value

View file

@ -50,6 +50,6 @@ func (*OnlyKeyRemoteServerInfo) ExternalAddresses() []string {
const invalidPrmValFmt = "invalid parameter %s (%T):%v"
func PanicOnPrmValue(n string, v interface{}) {
func PanicOnPrmValue(n string, v any) {
panic(fmt.Sprintf(invalidPrmValFmt, n, v, v))
}

View file

@ -41,7 +41,7 @@ type (
}
)
func panicOnPrmValue(n string, v interface{}) {
func panicOnPrmValue(n string, v any) {
panic(fmt.Sprintf("invalid parameter %s (%T):%v", n, v, v))
}

View file

@ -87,7 +87,7 @@ func TestDeleteBigObject(t *testing.T) {
}
}
func checkGetError(t *testing.T, e *StorageEngine, addr oid.Address, expected interface{}) {
func checkGetError(t *testing.T, e *StorageEngine, addr oid.Address, expected any) {
var getPrm GetPrm
getPrm.WithAddress(addr)

View file

@ -16,7 +16,7 @@ func Write(logger *logger.Logger, fields ...zap.Field) {
// AddressField returns logger's field for object address.
//
// Address should be type of *object.Address or string.
func AddressField(addr interface{}) zap.Field {
func AddressField(addr any) zap.Field {
return zap.Any("address", addr)
}

View file

@ -179,7 +179,7 @@ func wrapFrostFSError(err error) error {
// Invoke invokes contract method by sending transaction into blockchain.
// Supported args types: int64, string, util.Uint160, []byte and bool.
func (c *Client) Invoke(contract util.Uint160, fee fixedn.Fixed8, method string, args ...interface{}) error {
func (c *Client) Invoke(contract util.Uint160, fee fixedn.Fixed8, method string, args ...any) error {
c.switchLock.RLock()
defer c.switchLock.RUnlock()
@ -202,7 +202,7 @@ func (c *Client) Invoke(contract util.Uint160, fee fixedn.Fixed8, method string,
// TestInvoke invokes contract method locally in neo-go node. This method should
// be used to read data from smart-contract.
func (c *Client) TestInvoke(contract util.Uint160, method string, args ...interface{}) (res []stackitem.Item, err error) {
func (c *Client) TestInvoke(contract util.Uint160, method string, args ...any) (res []stackitem.Item, err error) {
c.switchLock.RLock()
defer c.switchLock.RUnlock()
@ -384,7 +384,7 @@ func (c *Client) roleList(r noderoles.Role) (keys.PublicKeys, error) {
// tries to resolve sc.Parameter from the arg.
//
// Wraps any error to frostfsError.
func toStackParameter(value interface{}) (sc.Parameter, error) {
func toStackParameter(value any) (sc.Parameter, error) {
var result = sc.Parameter{
Value: value,
}

View file

@ -10,9 +10,9 @@ import (
func TestToStackParameter(t *testing.T) {
items := []struct {
value interface{}
value any
expType sc.ParamType
expVal interface{}
expVal any
}{
{
value: []byte{1, 2, 3},

View file

@ -191,7 +191,7 @@ func (c *Client) readBoolConfig(key string) (bool, error) {
type SetConfigPrm struct {
id []byte
key []byte
value interface{}
value any
client.InvokePrmOptional
}
@ -207,7 +207,7 @@ func (s *SetConfigPrm) SetKey(key []byte) {
}
// SetValue sets value of the config value.
func (s *SetConfigPrm) SetValue(value interface{}) {
func (s *SetConfigPrm) SetValue(value any) {
s.value = value
}
@ -359,7 +359,7 @@ var ErrConfigNotFound = errors.New("config value not found")
// method of FrostFS Netmap contract.
//
// Returns ErrConfigNotFound if config key is not found in the contract.
func (c *Client) config(key []byte, assert func(stackitem.Item) (interface{}, error)) (interface{}, error) {
func (c *Client) config(key []byte, assert func(stackitem.Item) (any, error)) (any, error) {
prm := client.TestInvokePrm{}
prm.SetMethod(configMethod)
prm.SetArgs(key)
@ -383,17 +383,17 @@ func (c *Client) config(key []byte, assert func(stackitem.Item) (interface{}, er
}
// IntegerAssert converts stack item to int64.
func IntegerAssert(item stackitem.Item) (interface{}, error) {
func IntegerAssert(item stackitem.Item) (any, error) {
return client.IntFromStackItem(item)
}
// StringAssert converts stack item to string.
func StringAssert(item stackitem.Item) (interface{}, error) {
func StringAssert(item stackitem.Item) (any, error) {
return client.StringFromStackItem(item)
}
// BoolAssert converts stack item to bool.
func BoolAssert(item stackitem.Item) (interface{}, error) {
func BoolAssert(item stackitem.Item) (any, error) {
return client.BoolFromStackItem(item)
}

View file

@ -194,7 +194,7 @@ func (c *Client) depositNotary(amount fixedn.Fixed8, till int64) (res util.Uint2
c.accAddr,
c.notary.notary,
big.NewInt(int64(amount)),
[]interface{}{c.acc.PrivateKey().GetScriptHash(), till})
[]any{c.acc.PrivateKey().GetScriptHash(), till})
if err != nil {
if !errors.Is(err, neorpc.ErrAlreadyExists) {
return util.Uint256{}, fmt.Errorf("can't make notary deposit: %w", err)
@ -354,7 +354,7 @@ func (c *Client) UpdateNeoFSAlphabetList(prm UpdateAlphabetListPrm) error {
// it fallbacks to a simple `Invoke()`.
//
// `nonce` and `vub` are used only if notary is enabled.
func (c *Client) NotaryInvoke(contract util.Uint160, fee fixedn.Fixed8, nonce uint32, vub *uint32, method string, args ...interface{}) error {
func (c *Client) NotaryInvoke(contract util.Uint160, fee fixedn.Fixed8, nonce uint32, vub *uint32, method string, args ...any) error {
c.switchLock.RLock()
defer c.switchLock.RUnlock()
@ -374,7 +374,7 @@ func (c *Client) NotaryInvoke(contract util.Uint160, fee fixedn.Fixed8, nonce ui
// not expected to be signed by the current node.
//
// Considered to be used by non-IR nodes.
func (c *Client) NotaryInvokeNotAlpha(contract util.Uint160, fee fixedn.Fixed8, method string, args ...interface{}) error {
func (c *Client) NotaryInvokeNotAlpha(contract util.Uint160, fee fixedn.Fixed8, method string, args ...any) error {
c.switchLock.RLock()
defer c.switchLock.RUnlock()
@ -440,12 +440,12 @@ func (c *Client) NotarySignAndInvokeTX(mainTx *transaction.Transaction) error {
return nil
}
func (c *Client) notaryInvokeAsCommittee(method string, nonce, vub uint32, args ...interface{}) error {
func (c *Client) notaryInvokeAsCommittee(method string, nonce, vub uint32, args ...any) error {
designate := c.GetDesignateHash()
return c.notaryInvoke(true, true, designate, nonce, &vub, method, args...)
}
func (c *Client) notaryInvoke(committee, invokedByAlpha bool, contract util.Uint160, nonce uint32, vub *uint32, method string, args ...interface{}) error {
func (c *Client) notaryInvoke(committee, invokedByAlpha bool, contract util.Uint160, nonce uint32, vub *uint32, method string, args ...any) error {
alphabetList, err := c.notary.alphabetSource() // prepare arguments for test invocation
if err != nil {
return err
@ -750,7 +750,7 @@ func (c *Client) depositExpirationOf() (int64, error) {
return currentTillBig.Int64(), nil
}
func invocationParams(args ...interface{}) ([]sc.Parameter, error) {
func invocationParams(args ...any) ([]sc.Parameter, error) {
params := make([]sc.Parameter, 0, len(args))
for i := range args {

View file

@ -151,7 +151,7 @@ func (s StaticClient) Invoke(prm InvokePrm) error {
// TestInvokePrm groups parameters of the TestInvoke operation.
type TestInvokePrm struct {
method string
args []interface{}
args []any
}
// SetMethod sets method of the contract to call.
@ -160,7 +160,7 @@ func (ti *TestInvokePrm) SetMethod(method string) {
}
// SetArgs sets arguments of the contact call.
func (ti *TestInvokePrm) SetArgs(args ...interface{}) {
func (ti *TestInvokePrm) SetArgs(args ...any) {
ti.args = args
}

View file

@ -52,7 +52,7 @@ type ManageAdminsRes struct{}
func (x Client) ManageAdmins(prm ManageAdminsPrm) (*ManageAdminsPrm, error) {
var method string
args := make([]interface{}, 1, 3)
args := make([]any, 1, 3)
args[0] = prm.subnet
if prm.client {

View file

@ -8,7 +8,7 @@ import (
// UserAllowedPrm groups parameters of UserAllowed method of Subnet contract.
type UserAllowedPrm struct {
args [2]interface{}
args [2]any
}
// SetID sets identifier of the subnet in a binary FrostFS API protocol format.
@ -64,7 +64,7 @@ type ManageClientsPrm struct {
// remove or add client
rm bool
args [3]interface{}
args [3]any
}
// SetRemove marks client to be removed. By default, client is added.

View file

@ -9,7 +9,7 @@ import (
type DeletePrm struct {
cliPrm client.InvokePrm
args [1]interface{}
args [1]any
}
// SetTxHash sets hash of the transaction which spawned the notification.

View file

@ -8,7 +8,7 @@ import (
// GetPrm groups parameters of Get method of Subnet contract.
type GetPrm struct {
args [1]interface{}
args [1]any
}
// SetID sets identifier of the subnet to be read in a binary FrostFS API protocol format.

View file

@ -10,7 +10,7 @@ import (
type NodeAllowedPrm struct {
cliPrm client.TestInvokePrm
args [2]interface{}
args [2]any
}
// SetID sets identifier of the subnet of the node in a binary FrostFS API protocol format.

View file

@ -9,7 +9,7 @@ type ManageNodesPrm struct {
// remove or add node
rm bool
args [2]interface{}
args [2]any
}
// SetRemove marks node to be removed. By default, node is added.

View file

@ -9,7 +9,7 @@ import (
type PutPrm struct {
cliPrm client.InvokePrm
args [3]interface{}
args [3]any
}
// SetTxHash sets hash of the transaction which spawned the notification.

View file

@ -341,7 +341,7 @@ func TestPrepare_CorrectNR(t *testing.T) {
tests := []struct {
hash util.Uint160
method string
args []interface{}
args []any
}{
{
scriptHash,
@ -351,10 +351,10 @@ func TestPrepare_CorrectNR(t *testing.T) {
{
scriptHash,
"test2",
[]interface{}{
[]any{
int64(4),
"test",
[]interface{}{
[]any{
int64(4),
false,
true,
@ -416,7 +416,7 @@ func alphaKeysSource() client.AlphabetKeys {
}
}
func script(hash util.Uint160, method string, args ...interface{}) []byte {
func script(hash util.Uint160, method string, args ...any) []byte {
bw := io.NewBufBinWriter()
if len(args) > 0 {

View file

@ -25,7 +25,7 @@ func NewResponseService(accSvc Server, respSvc *response.Service) Server {
func (s *responseService) Balance(ctx context.Context, req *accounting.BalanceRequest) (*accounting.BalanceResponse, error) {
resp, err := s.respSvc.HandleUnaryRequest(ctx, req,
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
func(ctx context.Context, req any) (util.ResponseMessage, error) {
return s.svc.Balance(ctx, req.(*accounting.BalanceRequest))
},
)

View file

@ -23,7 +23,7 @@ func NewSignService(key *ecdsa.PrivateKey, svc Server) Server {
func (s *signService) Balance(ctx context.Context, req *accounting.BalanceRequest) (*accounting.BalanceResponse, error) {
resp, err := s.sigSvc.HandleUnaryRequest(ctx, req,
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
func(ctx context.Context, req any) (util.ResponseMessage, error) {
return s.svc.Balance(ctx, req.(*accounting.BalanceRequest))
},
func() util.ResponseMessage {

View file

@ -57,7 +57,7 @@ type Controller struct {
const invalidPrmValFmt = "invalid parameter %s (%T):%v"
func panicOnPrmValue(n string, v interface{}) {
func panicOnPrmValue(n string, v any) {
panic(fmt.Sprintf(invalidPrmValFmt, n, v, v))
}

View file

@ -27,7 +27,7 @@ type Builder struct {
const invalidPrmValFmt = "invalid parameter %s (%T):%v"
func panicOnPrmValue(n string, v interface{}) {
func panicOnPrmValue(n string, v any) {
panic(fmt.Sprintf(invalidPrmValFmt, n, v, v))
}

View file

@ -51,7 +51,7 @@ type Router struct {
const invalidPrmValFmt = "invalid parameter %s (%T):%v"
func panicOnPrmValue(n string, v interface{}) {
func panicOnPrmValue(n string, v any) {
panic(fmt.Sprintf(invalidPrmValFmt, n, v, v))
}

View file

@ -25,7 +25,7 @@ func NewResponseService(cnrSvc Server, respSvc *response.Service) Server {
func (s *responseService) Put(ctx context.Context, req *container.PutRequest) (*container.PutResponse, error) {
resp, err := s.respSvc.HandleUnaryRequest(ctx, req,
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
func(ctx context.Context, req any) (util.ResponseMessage, error) {
return s.svc.Put(ctx, req.(*container.PutRequest))
},
)
@ -38,7 +38,7 @@ func (s *responseService) Put(ctx context.Context, req *container.PutRequest) (*
func (s *responseService) Delete(ctx context.Context, req *container.DeleteRequest) (*container.DeleteResponse, error) {
resp, err := s.respSvc.HandleUnaryRequest(ctx, req,
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
func(ctx context.Context, req any) (util.ResponseMessage, error) {
return s.svc.Delete(ctx, req.(*container.DeleteRequest))
},
)
@ -51,7 +51,7 @@ func (s *responseService) Delete(ctx context.Context, req *container.DeleteReque
func (s *responseService) Get(ctx context.Context, req *container.GetRequest) (*container.GetResponse, error) {
resp, err := s.respSvc.HandleUnaryRequest(ctx, req,
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
func(ctx context.Context, req any) (util.ResponseMessage, error) {
return s.svc.Get(ctx, req.(*container.GetRequest))
},
)
@ -64,7 +64,7 @@ func (s *responseService) Get(ctx context.Context, req *container.GetRequest) (*
func (s *responseService) List(ctx context.Context, req *container.ListRequest) (*container.ListResponse, error) {
resp, err := s.respSvc.HandleUnaryRequest(ctx, req,
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
func(ctx context.Context, req any) (util.ResponseMessage, error) {
return s.svc.List(ctx, req.(*container.ListRequest))
},
)
@ -77,7 +77,7 @@ func (s *responseService) List(ctx context.Context, req *container.ListRequest)
func (s *responseService) SetExtendedACL(ctx context.Context, req *container.SetExtendedACLRequest) (*container.SetExtendedACLResponse, error) {
resp, err := s.respSvc.HandleUnaryRequest(ctx, req,
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
func(ctx context.Context, req any) (util.ResponseMessage, error) {
return s.svc.SetExtendedACL(ctx, req.(*container.SetExtendedACLRequest))
},
)
@ -90,7 +90,7 @@ func (s *responseService) SetExtendedACL(ctx context.Context, req *container.Set
func (s *responseService) GetExtendedACL(ctx context.Context, req *container.GetExtendedACLRequest) (*container.GetExtendedACLResponse, error) {
resp, err := s.respSvc.HandleUnaryRequest(ctx, req,
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
func(ctx context.Context, req any) (util.ResponseMessage, error) {
return s.svc.GetExtendedACL(ctx, req.(*container.GetExtendedACLRequest))
},
)
@ -103,7 +103,7 @@ func (s *responseService) GetExtendedACL(ctx context.Context, req *container.Get
func (s *responseService) AnnounceUsedSpace(ctx context.Context, req *container.AnnounceUsedSpaceRequest) (*container.AnnounceUsedSpaceResponse, error) {
resp, err := s.respSvc.HandleUnaryRequest(ctx, req,
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
func(ctx context.Context, req any) (util.ResponseMessage, error) {
return s.svc.AnnounceUsedSpace(ctx, req.(*container.AnnounceUsedSpaceRequest))
},
)

View file

@ -23,7 +23,7 @@ func NewSignService(key *ecdsa.PrivateKey, svc Server) Server {
func (s *signService) Put(ctx context.Context, req *container.PutRequest) (*container.PutResponse, error) {
resp, err := s.sigSvc.HandleUnaryRequest(ctx, req,
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
func(ctx context.Context, req any) (util.ResponseMessage, error) {
return s.svc.Put(ctx, req.(*container.PutRequest))
},
func() util.ResponseMessage {
@ -39,7 +39,7 @@ func (s *signService) Put(ctx context.Context, req *container.PutRequest) (*cont
func (s *signService) Delete(ctx context.Context, req *container.DeleteRequest) (*container.DeleteResponse, error) {
resp, err := s.sigSvc.HandleUnaryRequest(ctx, req,
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
func(ctx context.Context, req any) (util.ResponseMessage, error) {
return s.svc.Delete(ctx, req.(*container.DeleteRequest))
},
func() util.ResponseMessage {
@ -55,7 +55,7 @@ func (s *signService) Delete(ctx context.Context, req *container.DeleteRequest)
func (s *signService) Get(ctx context.Context, req *container.GetRequest) (*container.GetResponse, error) {
resp, err := s.sigSvc.HandleUnaryRequest(ctx, req,
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
func(ctx context.Context, req any) (util.ResponseMessage, error) {
return s.svc.Get(ctx, req.(*container.GetRequest))
},
func() util.ResponseMessage {
@ -71,7 +71,7 @@ func (s *signService) Get(ctx context.Context, req *container.GetRequest) (*cont
func (s *signService) List(ctx context.Context, req *container.ListRequest) (*container.ListResponse, error) {
resp, err := s.sigSvc.HandleUnaryRequest(ctx, req,
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
func(ctx context.Context, req any) (util.ResponseMessage, error) {
return s.svc.List(ctx, req.(*container.ListRequest))
},
func() util.ResponseMessage {
@ -87,7 +87,7 @@ func (s *signService) List(ctx context.Context, req *container.ListRequest) (*co
func (s *signService) SetExtendedACL(ctx context.Context, req *container.SetExtendedACLRequest) (*container.SetExtendedACLResponse, error) {
resp, err := s.sigSvc.HandleUnaryRequest(ctx, req,
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
func(ctx context.Context, req any) (util.ResponseMessage, error) {
return s.svc.SetExtendedACL(ctx, req.(*container.SetExtendedACLRequest))
},
func() util.ResponseMessage {
@ -103,7 +103,7 @@ func (s *signService) SetExtendedACL(ctx context.Context, req *container.SetExte
func (s *signService) GetExtendedACL(ctx context.Context, req *container.GetExtendedACLRequest) (*container.GetExtendedACLResponse, error) {
resp, err := s.sigSvc.HandleUnaryRequest(ctx, req,
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
func(ctx context.Context, req any) (util.ResponseMessage, error) {
return s.svc.GetExtendedACL(ctx, req.(*container.GetExtendedACLRequest))
},
func() util.ResponseMessage {
@ -119,7 +119,7 @@ func (s *signService) GetExtendedACL(ctx context.Context, req *container.GetExte
func (s *signService) AnnounceUsedSpace(ctx context.Context, req *container.AnnounceUsedSpaceRequest) (*container.AnnounceUsedSpaceResponse, error) {
resp, err := s.sigSvc.HandleUnaryRequest(ctx, req,
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
func(ctx context.Context, req any) (util.ResponseMessage, error) {
return s.svc.AnnounceUsedSpace(ctx, req.(*container.AnnounceUsedSpaceRequest))
},
func() util.ResponseMessage {

View file

@ -15,7 +15,7 @@ type Server struct {
allowedKeys [][]byte
}
func panicOnPrmValue(n string, v interface{}) {
func panicOnPrmValue(n string, v any) {
const invalidPrmValFmt = "invalid %s parameter (%T): %v"
panic(fmt.Sprintf(invalidPrmValFmt, n, v, v))
}

View file

@ -25,7 +25,7 @@ func NewResponseService(nmSvc Server, respSvc *response.Service) Server {
func (s *responseService) LocalNodeInfo(ctx context.Context, req *netmap.LocalNodeInfoRequest) (*netmap.LocalNodeInfoResponse, error) {
resp, err := s.respSvc.HandleUnaryRequest(ctx, req,
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
func(ctx context.Context, req any) (util.ResponseMessage, error) {
return s.svc.LocalNodeInfo(ctx, req.(*netmap.LocalNodeInfoRequest))
},
)
@ -38,7 +38,7 @@ func (s *responseService) LocalNodeInfo(ctx context.Context, req *netmap.LocalNo
func (s *responseService) NetworkInfo(ctx context.Context, req *netmap.NetworkInfoRequest) (*netmap.NetworkInfoResponse, error) {
resp, err := s.respSvc.HandleUnaryRequest(ctx, req,
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
func(ctx context.Context, req any) (util.ResponseMessage, error) {
return s.svc.NetworkInfo(ctx, req.(*netmap.NetworkInfoRequest))
},
)
@ -51,7 +51,7 @@ func (s *responseService) NetworkInfo(ctx context.Context, req *netmap.NetworkIn
func (s *responseService) Snapshot(ctx context.Context, req *netmap.SnapshotRequest) (*netmap.SnapshotResponse, error) {
resp, err := s.respSvc.HandleUnaryRequest(ctx, req,
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
func(ctx context.Context, req any) (util.ResponseMessage, error) {
return s.svc.Snapshot(ctx, req.(*netmap.SnapshotRequest))
},
)

View file

@ -25,7 +25,7 @@ func (s *signService) LocalNodeInfo(
ctx context.Context,
req *netmap.LocalNodeInfoRequest) (*netmap.LocalNodeInfoResponse, error) {
resp, err := s.sigSvc.HandleUnaryRequest(ctx, req,
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
func(ctx context.Context, req any) (util.ResponseMessage, error) {
return s.svc.LocalNodeInfo(ctx, req.(*netmap.LocalNodeInfoRequest))
},
func() util.ResponseMessage {
@ -41,7 +41,7 @@ func (s *signService) LocalNodeInfo(
func (s *signService) NetworkInfo(ctx context.Context, req *netmap.NetworkInfoRequest) (*netmap.NetworkInfoResponse, error) {
resp, err := s.sigSvc.HandleUnaryRequest(ctx, req,
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
func(ctx context.Context, req any) (util.ResponseMessage, error) {
return s.svc.NetworkInfo(ctx, req.(*netmap.NetworkInfoRequest))
},
func() util.ResponseMessage {
@ -57,7 +57,7 @@ func (s *signService) NetworkInfo(ctx context.Context, req *netmap.NetworkInfoRe
func (s *signService) Snapshot(ctx context.Context, req *netmap.SnapshotRequest) (*netmap.SnapshotResponse, error) {
resp, err := s.sigSvc.HandleUnaryRequest(ctx, req,
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
func(ctx context.Context, req any) (util.ResponseMessage, error) {
return s.svc.Snapshot(ctx, req.(*netmap.SnapshotRequest))
},
func() util.ResponseMessage {

View file

@ -52,7 +52,7 @@ type Notificator struct {
// Panics if any field of the passed Prm structure is not set/set
// to nil.
func New(prm *Prm) *Notificator {
panicOnNil := func(v interface{}, name string) {
panicOnNil := func(v any, name string) {
if v == nil {
panic(fmt.Sprintf("Notificator constructor: %s is nil\n", name))
}

View file

@ -71,7 +71,7 @@ var (
// NewChecker creates Checker.
// Panics if at least one of the parameter is nil.
func NewChecker(prm *CheckerPrm) *Checker {
panicOnNil := func(fieldName string, field interface{}) {
panicOnNil := func(fieldName string, field any) {
if field == nil {
panic(fmt.Sprintf("incorrect field %s (%T): %v", fieldName, field, field))
}
@ -118,7 +118,7 @@ func (c *Checker) StickyBitCheck(info v2.RequestInfo, owner user.ID) bool {
}
// CheckEACL is a main check function for extended ACL.
func (c *Checker) CheckEACL(msg interface{}, reqInfo v2.RequestInfo) error {
func (c *Checker) CheckEACL(msg any, reqInfo v2.RequestInfo) error {
basicACL := reqInfo.BasicACL()
if !basicACL.Extendable() {
return nil

View file

@ -32,7 +32,7 @@ type RequestInfo struct {
bearer *bearer.Token // bearer token of request
srcRequest interface{}
srcRequest any
}
func (r *RequestInfo) SetBasicACL(basicACL acl.Basic) {
@ -48,7 +48,7 @@ func (r *RequestInfo) SetSenderKey(senderKey []byte) {
}
// Request returns raw API request.
func (r RequestInfo) Request() interface{} {
func (r RequestInfo) Request() any {
return r.srcRequest
}
@ -103,7 +103,7 @@ type MetaWithToken struct {
vheader *sessionV2.RequestVerificationHeader
token *sessionSDK.Object
bearer *bearer.Token
src interface{}
src any
}
// RequestOwner returns ownerID and its public key

View file

@ -86,7 +86,7 @@ func New(opts ...Option) Service {
opts[i](cfg)
}
panicOnNil := func(v interface{}, name string) {
panicOnNil := func(v any, name string) {
if v == nil {
panic(fmt.Sprintf("ACL service: %s is nil", name))
}

View file

@ -12,7 +12,7 @@ type ACLChecker interface {
CheckBasicACL(RequestInfo) bool
// CheckEACL must return non-nil error if request
// doesn't pass extended ACL validation.
CheckEACL(interface{}, RequestInfo) error
CheckEACL(any, RequestInfo) error
// StickyBitCheck must return true only if sticky bit
// is disabled or enabled but request contains correct
// owner field.

View file

@ -20,7 +20,7 @@ import (
var errMissingContainerID = errors.New("missing container ID")
func getContainerIDFromRequest(req interface{}) (cid.ID, error) {
func getContainerIDFromRequest(req any) (cid.ID, error) {
var idV2 *refsV2.ContainerID
var id cid.ID

View file

@ -7,7 +7,7 @@ import (
const defaultAllocSize = 1024
var putBytesPool = &sync.Pool{
New: func() interface{} { return make([]byte, 0, defaultAllocSize) },
New: func() any { return make([]byte, 0, defaultAllocSize) },
}
func getPayload() []byte {

View file

@ -80,7 +80,7 @@ func (s *ResponseService) Put(ctx context.Context) (PutObjectStream, error) {
return &putStreamResponser{
stream: s.respSvc.CreateRequestStreamer(
func(req interface{}) error {
func(req any) error {
return stream.Send(req.(*object.PutRequest))
},
func() (util.ResponseMessage, error) {
@ -92,7 +92,7 @@ func (s *ResponseService) Put(ctx context.Context) (PutObjectStream, error) {
func (s *ResponseService) Head(ctx context.Context, req *object.HeadRequest) (*object.HeadResponse, error) {
resp, err := s.respSvc.HandleUnaryRequest(ctx, req,
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
func(ctx context.Context, req any) (util.ResponseMessage, error) {
return s.svc.Head(ctx, req.(*object.HeadRequest))
},
)
@ -118,7 +118,7 @@ func (s *ResponseService) Search(req *object.SearchRequest, stream SearchStream)
func (s *ResponseService) Delete(ctx context.Context, req *object.DeleteRequest) (*object.DeleteResponse, error) {
resp, err := s.respSvc.HandleUnaryRequest(ctx, req,
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
func(ctx context.Context, req any) (util.ResponseMessage, error) {
return s.svc.Delete(ctx, req.(*object.DeleteRequest))
},
)
@ -144,7 +144,7 @@ func (s *ResponseService) GetRange(req *object.GetRangeRequest, stream GetObject
func (s *ResponseService) GetRangeHash(ctx context.Context, req *object.GetRangeHashRequest) (*object.GetRangeHashResponse, error) {
resp, err := s.respSvc.HandleUnaryRequest(ctx, req,
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
func(ctx context.Context, req any) (util.ResponseMessage, error) {
return s.svc.GetRangeHash(ctx, req.(*object.GetRangeHashRequest))
},
)

View file

@ -91,7 +91,7 @@ func (s *SignService) Put(ctx context.Context) (PutObjectStream, error) {
return &putStreamSigner{
stream: s.sigSvc.CreateRequestStreamer(
func(req interface{}) error {
func(req any) error {
return stream.Send(req.(*object.PutRequest))
},
func() (util.ResponseMessage, error) {
@ -106,7 +106,7 @@ func (s *SignService) Put(ctx context.Context) (PutObjectStream, error) {
func (s *SignService) Head(ctx context.Context, req *object.HeadRequest) (*object.HeadResponse, error) {
resp, err := s.sigSvc.HandleUnaryRequest(ctx, req,
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
func(ctx context.Context, req any) (util.ResponseMessage, error) {
return s.svc.Head(ctx, req.(*object.HeadRequest))
},
func() util.ResponseMessage {
@ -157,7 +157,7 @@ func (s *SignService) Search(req *object.SearchRequest, stream SearchStream) err
func (s *SignService) Delete(ctx context.Context, req *object.DeleteRequest) (*object.DeleteResponse, error) {
resp, err := s.sigSvc.HandleUnaryRequest(ctx, req,
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
func(ctx context.Context, req any) (util.ResponseMessage, error) {
return s.svc.Delete(ctx, req.(*object.DeleteRequest))
},
func() util.ResponseMessage {
@ -194,7 +194,7 @@ func (s *SignService) GetRange(req *object.GetRangeRequest, stream GetObjectRang
func (s *SignService) GetRangeHash(ctx context.Context, req *object.GetRangeHashRequest) (*object.GetRangeHashResponse, error) {
resp, err := s.sigSvc.HandleUnaryRequest(ctx, req,
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
func(ctx context.Context, req any) (util.ResponseMessage, error) {
return s.svc.GetRangeHash(ctx, req.(*object.GetRangeHashRequest))
},
func() util.ResponseMessage {

View file

@ -14,7 +14,7 @@ type HeadReceiver interface {
// Head must return one of:
// * object header (*object.Object);
// * structured information about split-chain (*object.SplitInfo).
Head(id oid.Address) (interface{}, error)
Head(id oid.Address) (any, error)
}
// SplitMemberHandler is a handler of next split-chain element.

View file

@ -40,7 +40,7 @@ func NewChecker(oo ...Option) *ExpirationChecker {
o(cfg)
}
panicOnNil := func(v interface{}, name string) {
panicOnNil := func(v any, name string) {
if v == nil {
panic(fmt.Sprintf("tombstone getter constructor: %s is nil", name))
}

View file

@ -52,7 +52,7 @@ type Router struct {
const invalidPrmValFmt = "invalid parameter %s (%T):%v"
func panicOnPrmValue(n string, v interface{}) {
func panicOnPrmValue(n string, v any) {
panic(fmt.Sprintf(invalidPrmValFmt, n, v, v))
}

View file

@ -51,7 +51,7 @@ type Calculator struct {
const invalidPrmValFmt = "invalid parameter %s (%T):%v"
func panicOnPrmValue(n string, v interface{}) {
func panicOnPrmValue(n string, v any) {
panic(fmt.Sprintf(invalidPrmValFmt, n, v, v))
}

View file

@ -52,7 +52,7 @@ type Controller struct {
const invalidPrmValFmt = "invalid parameter %s (%T):%v"
func panicOnPrmValue(n string, v interface{}) {
func panicOnPrmValue(n string, v any) {
panic(fmt.Sprintf(invalidPrmValFmt, n, v, v))
}

View file

@ -34,7 +34,7 @@ type Builder struct {
const invalidPrmValFmt = "invalid parameter %s (%T):%v"
func panicOnPrmValue(n string, v interface{}) {
func panicOnPrmValue(n string, v any) {
panic(fmt.Sprintf(invalidPrmValFmt, n, v, v))
}

View file

@ -52,7 +52,7 @@ type Controller struct {
const invalidPrmValFmt = "invalid parameter %s (%T):%v"
func panicOnPrmValue(n string, v interface{}) {
func panicOnPrmValue(n string, v any) {
panic(fmt.Sprintf(invalidPrmValFmt, n, v, v))
}

View file

@ -34,7 +34,7 @@ type Builder struct {
const invalidPrmValFmt = "invalid parameter %s (%T):%v"
func panicOnPrmValue(n string, v interface{}) {
func panicOnPrmValue(n string, v any) {
panic(fmt.Sprintf(invalidPrmValFmt, n, v, v))
}

View file

@ -25,7 +25,7 @@ func NewResponseService(cnrSvc Server, respSvc *response.Service) Server {
func (s *responseService) AnnounceLocalTrust(ctx context.Context, req *reputation.AnnounceLocalTrustRequest) (*reputation.AnnounceLocalTrustResponse, error) {
resp, err := s.respSvc.HandleUnaryRequest(ctx, req,
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
func(ctx context.Context, req any) (util.ResponseMessage, error) {
return s.svc.AnnounceLocalTrust(ctx, req.(*reputation.AnnounceLocalTrustRequest))
},
)
@ -38,7 +38,7 @@ func (s *responseService) AnnounceLocalTrust(ctx context.Context, req *reputatio
func (s *responseService) AnnounceIntermediateResult(ctx context.Context, req *reputation.AnnounceIntermediateResultRequest) (*reputation.AnnounceIntermediateResultResponse, error) {
resp, err := s.respSvc.HandleUnaryRequest(ctx, req,
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
func(ctx context.Context, req any) (util.ResponseMessage, error) {
return s.svc.AnnounceIntermediateResult(ctx, req.(*reputation.AnnounceIntermediateResultRequest))
},
)

View file

@ -23,7 +23,7 @@ func NewSignService(key *ecdsa.PrivateKey, svc Server) Server {
func (s *signService) AnnounceLocalTrust(ctx context.Context, req *reputation.AnnounceLocalTrustRequest) (*reputation.AnnounceLocalTrustResponse, error) {
resp, err := s.sigSvc.HandleUnaryRequest(ctx, req,
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
func(ctx context.Context, req any) (util.ResponseMessage, error) {
return s.svc.AnnounceLocalTrust(ctx, req.(*reputation.AnnounceLocalTrustRequest))
},
func() util.ResponseMessage {
@ -39,7 +39,7 @@ func (s *signService) AnnounceLocalTrust(ctx context.Context, req *reputation.An
func (s *signService) AnnounceIntermediateResult(ctx context.Context, req *reputation.AnnounceIntermediateResultRequest) (*reputation.AnnounceIntermediateResultResponse, error) {
resp, err := s.sigSvc.HandleUnaryRequest(ctx, req,
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
func(ctx context.Context, req any) (util.ResponseMessage, error) {
return s.svc.AnnounceIntermediateResult(ctx, req.(*reputation.AnnounceIntermediateResultRequest))
},
func() util.ResponseMessage {

View file

@ -25,7 +25,7 @@ func NewResponseService(ssSvc Server, respSvc *response.Service) Server {
func (s *responseService) Create(ctx context.Context, req *session.CreateRequest) (*session.CreateResponse, error) {
resp, err := s.respSvc.HandleUnaryRequest(ctx, req,
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
func(ctx context.Context, req any) (util.ResponseMessage, error) {
return s.svc.Create(ctx, req.(*session.CreateRequest))
},
)

View file

@ -23,7 +23,7 @@ func NewSignService(key *ecdsa.PrivateKey, svc Server) Server {
func (s *signService) Create(ctx context.Context, req *session.CreateRequest) (*session.CreateResponse, error) {
resp, err := s.sigSvc.HandleUnaryRequest(ctx, req,
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
func(ctx context.Context, req any) (util.ResponseMessage, error) {
return s.svc.Create(ctx, req.(*session.CreateRequest))
},
func() util.ResponseMessage {

View file

@ -17,7 +17,7 @@ type ClientMessageStreamer struct {
}
// Send calls send method of internal streamer.
func (s *ClientMessageStreamer) Send(req interface{}) error {
func (s *ClientMessageStreamer) Send(req any) error {
if err := s.send(req); err != nil {
return fmt.Errorf("(%T) could not send the request: %w", s, err)
}

View file

@ -8,7 +8,7 @@ import (
)
// HandleUnaryRequest call passes request to handler, sets response meta header values and returns it.
func (s *Service) HandleUnaryRequest(ctx context.Context, req interface{}, handler util.UnaryHandler) (util.ResponseMessage, error) {
func (s *Service) HandleUnaryRequest(ctx context.Context, req any, handler util.UnaryHandler) (util.ResponseMessage, error) {
// process request
resp, err := handler(ctx, req)
if err != nil {

View file

@ -21,7 +21,7 @@ type ResponseMessage interface {
SetMetaHeader(*session.ResponseMetaHeader)
}
type UnaryHandler func(context.Context, interface{}) (ResponseMessage, error)
type UnaryHandler func(context.Context, any) (ResponseMessage, error)
type SignService struct {
key *ecdsa.PrivateKey
@ -29,7 +29,7 @@ type SignService struct {
type ResponseMessageWriter func(ResponseMessage) error
type ServerStreamHandler func(context.Context, interface{}) (ResponseMessageReader, error)
type ServerStreamHandler func(context.Context, any) (ResponseMessageReader, error)
type ResponseMessageReader func() (ResponseMessage, error)
@ -37,7 +37,7 @@ var ErrAbortStream = errors.New("abort message stream")
type ResponseConstructor func() ResponseMessage
type RequestMessageWriter func(interface{}) error
type RequestMessageWriter func(any) error
type ClientStreamCloser func() (ResponseMessage, error)
@ -61,7 +61,7 @@ func NewUnarySignService(key *ecdsa.PrivateKey) *SignService {
}
}
func (s *RequestMessageStreamer) Send(req interface{}) error {
func (s *RequestMessageStreamer) Send(req any) error {
// req argument should be strengthen with type RequestMessage
s.statusSupported = isStatusSupported(req.(RequestMessage)) // panic is OK here for now
@ -130,7 +130,7 @@ func (s *SignService) CreateRequestStreamer(sender RequestMessageWriter, closer
}
func (s *SignService) HandleServerStreamRequest(
req interface{},
req any,
respWriter ResponseMessageWriter,
blankResp ResponseConstructor,
respWriterCaller func(ResponseMessageWriter) error,
@ -172,7 +172,7 @@ func (s *SignService) HandleServerStreamRequest(
return nil
}
func (s *SignService) HandleUnaryRequest(ctx context.Context, req interface{}, handler UnaryHandler, blankResp ResponseConstructor) (ResponseMessage, error) {
func (s *SignService) HandleUnaryRequest(ctx context.Context, req any, handler UnaryHandler, blankResp ResponseConstructor) (ResponseMessage, error) {
// handle protocol versions <=2.10 (API statuses was introduced in 2.11 only)
// req argument should be strengthen with type RequestMessage
@ -233,7 +233,7 @@ func setStatusV2(resp ResponseMessage, err error) {
// 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;
// - 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 any, statusSupported bool) error {
err := signature.SignServiceMessage(key, resp)
if err != nil {
err = fmt.Errorf("could not sign response: %w", err)

View file

@ -37,15 +37,15 @@ type Server struct {
const invalidValFmt = "invalid %s %s (%T): %v"
func panicOnPrmValue(n string, v interface{}) {
func panicOnPrmValue(n string, v any) {
panicOnValue("parameter", n, v)
}
func panicOnOptValue(n string, v interface{}) {
func panicOnOptValue(n string, v any) {
panicOnValue("option", n, v)
}
func panicOnValue(t, n string, v interface{}) {
func panicOnValue(t, n string, v any) {
panic(fmt.Sprintf(invalidValFmt, t, n, v, v))
}

View file

@ -46,7 +46,7 @@ type pathMode struct {
const invalidPrmValFmt = "invalid parameter %s (%T):%v"
func panicOnPrmValue(n string, v interface{}) {
func panicOnPrmValue(n string, v any) {
panic(fmt.Sprintf(invalidPrmValFmt, n, v, v))
}

View file

@ -43,7 +43,7 @@ type DB struct {
const invalidPrmValFmt = "invalid parameter %s (%T):%v"
func panicOnPrmValue(n string, v interface{}) {
func panicOnPrmValue(n string, v any) {
panic(fmt.Sprintf(invalidPrmValFmt, n, v, v))
}

View file

@ -35,7 +35,7 @@ type DB struct {
const invalidPrmValFmt = "invalid parameter %s (%T):%v"
func panicOnPrmValue(n string, v interface{}) {
func panicOnPrmValue(n string, v any) {
panic(fmt.Sprintf(invalidPrmValFmt, n, v, v))
}

View file

@ -43,7 +43,7 @@ type Table struct {
const invalidPrmValFmt = "invalid parameter %s (%T):%v"
func panicOnPrmValue(n string, v interface{}) {
func panicOnPrmValue(n string, v any) {
panic(fmt.Sprintf(invalidPrmValFmt, n, v, v))
}