diff --git a/pkg/neorpc/types.go b/pkg/neorpc/types.go index 8a2a24dd2..93e60e6a1 100644 --- a/pkg/neorpc/types.go +++ b/pkg/neorpc/types.go @@ -55,7 +55,7 @@ type ( Error *Error `json:"error,omitempty"` } - // Raw represents a standard raw JSON-RPC 2.0 + // Response represents a standard raw JSON-RPC 2.0 // response: http://www.jsonrpc.org/specification#response_object. Response struct { HeaderAndError diff --git a/pkg/network/payload/inventory_test.go b/pkg/network/payload/inventory_test.go index 3b684367b..d4c5c4917 100644 --- a/pkg/network/payload/inventory_test.go +++ b/pkg/network/payload/inventory_test.go @@ -6,13 +6,13 @@ import ( "github.com/nspcc-dev/neo-go/internal/testserdes" "github.com/nspcc-dev/neo-go/pkg/crypto/hash" - . "github.com/nspcc-dev/neo-go/pkg/util" + "github.com/nspcc-dev/neo-go/pkg/util" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) func TestInventoryEncodeDecode(t *testing.T) { - hashes := []Uint256{ + hashes := []util.Uint256{ hash.Sha256([]byte("a")), hash.Sha256([]byte("b")), } @@ -22,7 +22,7 @@ func TestInventoryEncodeDecode(t *testing.T) { } func TestEmptyInv(t *testing.T) { - msgInv := NewInventory(TXType, []Uint256{}) + msgInv := NewInventory(TXType, []util.Uint256{}) data, err := testserdes.EncodeBinary(msgInv) assert.Nil(t, err) diff --git a/pkg/rpcclient/invoker/doc_test.go b/pkg/rpcclient/invoker/doc_test.go index 882f35a65..28476b84f 100644 --- a/pkg/rpcclient/invoker/doc_test.go +++ b/pkg/rpcclient/invoker/doc_test.go @@ -34,7 +34,7 @@ func ExampleInvoker() { res, _ := inv.Call(neo.Hash, "transfer", acc, util.Uint160{1, 2, 3}, 1, nil) if res.State == vmstate.Halt.String() { panic("NEO is broken!") // inv has no signers and transfer requires a witness to be performed. - } else { + } else { // nolint:revive // superfluous-else: if block ends with call to panic function, so drop this else and outdent its block (revive) println("ok") // this actually should fail } diff --git a/pkg/vm/stackitem/json.go b/pkg/vm/stackitem/json.go index 77e17f056..a2186ed1f 100644 --- a/pkg/vm/stackitem/json.go +++ b/pkg/vm/stackitem/json.go @@ -184,13 +184,15 @@ func FromJSON(data []byte, maxCount int, bestIntPrecision bool) (Item, error) { bestIntPrecision: bestIntPrecision, } d.UseNumber() - if item, err := d.decode(); err != nil { + item, err := d.decode() + if err != nil { return nil, err - } else if _, err := d.Token(); !errors.Is(err, gio.EOF) { - return nil, fmt.Errorf("%w: unexpected items", ErrInvalidValue) - } else { - return item, nil } + _, err = d.Token() + if !errors.Is(err, gio.EOF) { + return nil, fmt.Errorf("%w: unexpected items", ErrInvalidValue) + } + return item, nil } func (d *decoder) decode() (Item, error) {