Merge pull request #3171 from nspcc-dev/fix-linter

Fix linter problems
This commit is contained in:
Roman Khimov 2023-10-20 21:14:41 +03:00 committed by GitHub
commit dffd87c6c8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 10 deletions

View file

@ -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

View file

@ -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)

View file

@ -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
}

View file

@ -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) {