Skip to content

Commit

Permalink
Merge pull request #3171 from nspcc-dev/fix-linter
Browse files Browse the repository at this point in the history
Fix linter problems
  • Loading branch information
roman-khimov committed Oct 20, 2023
2 parents c3955f8 + 7a6b908 commit dffd87c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion pkg/neorpc/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions pkg/network/payload/inventory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")),
}
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion pkg/rpcclient/invoker/doc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
10 changes: 6 additions & 4 deletions pkg/vm/stackitem/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
}
_, err = d.Token()
if !errors.Is(err, gio.EOF) {
return nil, fmt.Errorf("%w: unexpected items", ErrInvalidValue)
} else {
return item, nil
}
return item, nil
}

func (d *decoder) decode() (Item, error) {
Expand Down

0 comments on commit dffd87c

Please sign in to comment.