From cf2e6296b74a5fedecad0984b173eedb959621ab Mon Sep 17 00:00:00 2001 From: Ekaterina Pavlova Date: Thu, 26 Sep 2024 11:56:53 +0300 Subject: [PATCH] *: fix linter gofmt errors ``` pkg/vm/stackitem/json_test.go:11 gofmt File is not `gofmt`-ed with `-s` `-r 'interface{} -> any'` pkg/core/native/native_test/cryptolib_test.go:471 gofmt File is not `gofmt`-ed with `-s` `-r 'interface{} -> any'` pkg/rpcclient/nns/contract_test.go:585 gofmt File is not `gofmt`-ed with `-s` `-r 'interface{} -> any'` ``` Signed-off-by: Ekaterina Pavlova --- pkg/core/native/native_test/cryptolib_test.go | 2 +- pkg/rpcclient/nns/contract_test.go | 44 +++++++++---------- pkg/vm/stackitem/json_test.go | 4 +- 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/pkg/core/native/native_test/cryptolib_test.go b/pkg/core/native/native_test/cryptolib_test.go index 1982f26da9..a8f14a8460 100644 --- a/pkg/core/native/native_test/cryptolib_test.go +++ b/pkg/core/native/native_test/cryptolib_test.go @@ -468,5 +468,5 @@ func TestVerifyGroth16Proof(t *testing.T) { publicWitness := make([]byte, fr.Bytes) // Verify. - validatorInvoker.Invoke(t, true, "verifyProof", argA, argB, argC, []interface{}{publicWitness}) + validatorInvoker.Invoke(t, true, "verifyProof", argA, argB, argC, []any{publicWitness}) } diff --git a/pkg/rpcclient/nns/contract_test.go b/pkg/rpcclient/nns/contract_test.go index 1e3e962323..5a1efe51db 100644 --- a/pkg/rpcclient/nns/contract_test.go +++ b/pkg/rpcclient/nns/contract_test.go @@ -582,8 +582,8 @@ func TestSetAdmin(t *testing.T) { testCases := []struct { name string setup func() - testFunc func() (interface{}, error) - want interface{} + testFunc func() (any, error) + want any wantErr bool }{ { @@ -591,9 +591,9 @@ func TestSetAdmin(t *testing.T) { setup: func() { ta.err = errors.New("test error") }, - testFunc: func() (interface{}, error) { + testFunc: func() (any, error) { txh, vub, err := c.SetAdmin(name, admin) - return []interface{}{txh, vub}, err + return []any{txh, vub}, err }, wantErr: true, }, @@ -604,11 +604,11 @@ func TestSetAdmin(t *testing.T) { ta.txh = txhMock ta.vub = 42 }, - testFunc: func() (interface{}, error) { + testFunc: func() (any, error) { txh, vub, err := c.SetAdmin(name, admin) - return []interface{}{txh, vub}, err + return []any{txh, vub}, err }, - want: []interface{}{txhMock, uint32(42)}, + want: []any{txhMock, uint32(42)}, }, { name: "SetAdminTransaction - Success", @@ -616,7 +616,7 @@ func TestSetAdmin(t *testing.T) { ta.err = nil ta.tx = txMock }, - testFunc: func() (interface{}, error) { + testFunc: func() (any, error) { return c.SetAdminTransaction(name, admin) }, want: txMock, @@ -626,7 +626,7 @@ func TestSetAdmin(t *testing.T) { setup: func() { ta.err = errors.New("test error") }, - testFunc: func() (interface{}, error) { + testFunc: func() (any, error) { return c.SetAdminTransaction(name, admin) }, wantErr: true, @@ -637,7 +637,7 @@ func TestSetAdmin(t *testing.T) { ta.err = nil ta.tx = txMock }, - testFunc: func() (interface{}, error) { + testFunc: func() (any, error) { return c.SetAdminUnsigned(name, admin) }, want: txMock, @@ -647,7 +647,7 @@ func TestSetAdmin(t *testing.T) { setup: func() { ta.err = errors.New("test error") }, - testFunc: func() (interface{}, error) { + testFunc: func() (any, error) { return c.SetAdminUnsigned(name, admin) }, wantErr: true, @@ -681,8 +681,8 @@ func TestSetRecord(t *testing.T) { testCases := []struct { name string setup func() - testFunc func() (interface{}, error) - want interface{} + testFunc func() (any, error) + want any wantErr bool }{ { @@ -690,9 +690,9 @@ func TestSetRecord(t *testing.T) { setup: func() { ta.err = errors.New("test error") }, - testFunc: func() (interface{}, error) { + testFunc: func() (any, error) { txh, vub, err := c.SetRecord(name, typev, data) - return []interface{}{txh, vub}, err + return []any{txh, vub}, err }, wantErr: true, }, @@ -703,11 +703,11 @@ func TestSetRecord(t *testing.T) { ta.txh = txhMock ta.vub = 42 }, - testFunc: func() (interface{}, error) { + testFunc: func() (any, error) { txh, vub, err := c.SetRecord(name, typev, data) - return []interface{}{txh, vub}, err + return []any{txh, vub}, err }, - want: []interface{}{txhMock, uint32(42)}, + want: []any{txhMock, uint32(42)}, }, { name: "SetRecordTransaction - Success", @@ -715,7 +715,7 @@ func TestSetRecord(t *testing.T) { ta.err = nil ta.tx = txMock }, - testFunc: func() (interface{}, error) { + testFunc: func() (any, error) { return c.SetRecordTransaction(name, typev, data) }, want: txMock, @@ -725,7 +725,7 @@ func TestSetRecord(t *testing.T) { setup: func() { ta.err = errors.New("test error") }, - testFunc: func() (interface{}, error) { + testFunc: func() (any, error) { return c.SetRecordTransaction(name, typev, data) }, wantErr: true, @@ -736,7 +736,7 @@ func TestSetRecord(t *testing.T) { ta.err = nil ta.tx = txMock }, - testFunc: func() (interface{}, error) { + testFunc: func() (any, error) { return c.SetRecordUnsigned(name, typev, data) }, want: txMock, @@ -746,7 +746,7 @@ func TestSetRecord(t *testing.T) { setup: func() { ta.err = errors.New("test error") }, - testFunc: func() (interface{}, error) { + testFunc: func() (any, error) { return c.SetRecordUnsigned(name, typev, data) }, wantErr: true, diff --git a/pkg/vm/stackitem/json_test.go b/pkg/vm/stackitem/json_test.go index b8e6912570..c0f980fded 100644 --- a/pkg/vm/stackitem/json_test.go +++ b/pkg/vm/stackitem/json_test.go @@ -8,11 +8,11 @@ import ( "github.com/stretchr/testify/require" ) -func getTestDecodeFunc(js string, expected ...interface{}) func(t *testing.T) { +func getTestDecodeFunc(js string, expected ...any) func(t *testing.T) { return getTestDecodeEncodeFunc(js, true, expected...) } -func getTestDecodeEncodeFunc(js string, needEncode bool, expected ...interface{}) func(t *testing.T) { +func getTestDecodeEncodeFunc(js string, needEncode bool, expected ...any) func(t *testing.T) { return func(t *testing.T) { actual, err := FromJSON([]byte(js), 20, true) if expected[0] == nil {