ci: fix lint issues (fix #2948)
This commit is contained in:
parent
de7bff9cea
commit
d36df15878
10 changed files with 23 additions and 15 deletions
|
@ -69,3 +69,7 @@ issues:
|
||||||
- EXC0003 # test/Test ... consider calling this
|
- EXC0003 # test/Test ... consider calling this
|
||||||
- EXC0004 # govet
|
- EXC0004 # govet
|
||||||
- EXC0005 # C-style breaks
|
- EXC0005 # C-style breaks
|
||||||
|
exclude-rules:
|
||||||
|
- linters:
|
||||||
|
- revive
|
||||||
|
text: "unused-parameter"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module github.com/nspcc-dev/neo-go/examples/oracle
|
module github.com/nspcc-dev/neo-go/internal/examples/oracle
|
||||||
|
|
||||||
go 1.17
|
go 1.17
|
||||||
|
|
||||||
|
|
|
@ -457,7 +457,8 @@ func (v *Version) FromBytes(data []byte) error {
|
||||||
return errors.New("missing version")
|
return errors.New("missing version")
|
||||||
}
|
}
|
||||||
i := 0
|
i := 0
|
||||||
for ; i < len(data) && data[i] != '\x00'; i++ {
|
for i < len(data) && data[i] != '\x00' {
|
||||||
|
i++
|
||||||
}
|
}
|
||||||
|
|
||||||
if i == len(data) {
|
if i == len(data) {
|
||||||
|
|
|
@ -120,7 +120,7 @@ func Find(ic *interop.Context) error {
|
||||||
// Underlying persistent store is likely to be a private MemCachedStore. Thus,
|
// Underlying persistent store is likely to be a private MemCachedStore. Thus,
|
||||||
// to avoid concurrent map iteration and map write we need to wait until internal
|
// to avoid concurrent map iteration and map write we need to wait until internal
|
||||||
// seek goroutine is finished, because it can access underlying persistent store.
|
// seek goroutine is finished, because it can access underlying persistent store.
|
||||||
for range seekres {
|
for range seekres { //nolint:revive //empty-block
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -282,7 +282,7 @@ func (m *Management) getContractHashes(ic *interop.Context, _ []stackitem.Item)
|
||||||
item := istorage.NewIterator(filteredRes, prefix, int64(opts))
|
item := istorage.NewIterator(filteredRes, prefix, int64(opts))
|
||||||
ic.RegisterCancelFunc(func() {
|
ic.RegisterCancelFunc(func() {
|
||||||
cancel()
|
cancel()
|
||||||
for range seekres {
|
for range seekres { //nolint:revive //empty-block
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return stackitem.NewInterop(item)
|
return stackitem.NewInterop(item)
|
||||||
|
|
|
@ -1022,7 +1022,7 @@ func (n *NEO) getAllCandidatesCall(ic *interop.Context, _ []stackitem.Item) stac
|
||||||
item := istorage.NewIterator(filteredRes, prefix, int64(opts))
|
item := istorage.NewIterator(filteredRes, prefix, int64(opts))
|
||||||
ic.RegisterCancelFunc(func() {
|
ic.RegisterCancelFunc(func() {
|
||||||
cancel()
|
cancel()
|
||||||
for range seekres {
|
for range seekres { //nolint:revive //empty-block
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return stackitem.NewInterop(item)
|
return stackitem.NewInterop(item)
|
||||||
|
|
|
@ -11,7 +11,8 @@ import (
|
||||||
func connReadStub(conn net.Conn) {
|
func connReadStub(conn net.Conn) {
|
||||||
b := make([]byte, 1024)
|
b := make([]byte, 1024)
|
||||||
var err error
|
var err error
|
||||||
for ; err == nil; _, err = conn.Read(b) {
|
for err == nil {
|
||||||
|
_, err = conn.Read(b)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ func ExampleActor() {
|
||||||
// have a signer with the first wallet account and CalledByEntry scope.
|
// have a signer with the first wallet account and CalledByEntry scope.
|
||||||
res, _ := a.Call(customContract, "method", 1, 2, 3)
|
res, _ := a.Call(customContract, "method", 1, 2, 3)
|
||||||
if res.State != vmstate.Halt.String() {
|
if res.State != vmstate.Halt.String() {
|
||||||
// The call failed.
|
panic("failed")
|
||||||
}
|
}
|
||||||
// All of the side-effects in res can be analyzed.
|
// All of the side-effects in res can be analyzed.
|
||||||
|
|
||||||
|
|
|
@ -33,9 +33,9 @@ func ExampleInvoker() {
|
||||||
// Test-invoke transfer call.
|
// Test-invoke transfer call.
|
||||||
res, _ := inv.Call(neo.Hash, "transfer", acc, util.Uint160{1, 2, 3}, 1, nil)
|
res, _ := inv.Call(neo.Hash, "transfer", acc, util.Uint160{1, 2, 3}, 1, nil)
|
||||||
if res.State == vmstate.Halt.String() {
|
if res.State == vmstate.Halt.String() {
|
||||||
// NEO is broken! inv has no signers and transfer requires a witness to be performed.
|
panic("NEO is broken!") // inv has no signers and transfer requires a witness to be performed.
|
||||||
} else {
|
} else {
|
||||||
// OK, this actually should fail.
|
println("ok") // this actually should fail
|
||||||
}
|
}
|
||||||
|
|
||||||
// A historic invoker with no signers at block 1000000.
|
// A historic invoker with no signers at block 1000000.
|
||||||
|
@ -57,9 +57,11 @@ func ExampleInvoker() {
|
||||||
// transfer actually returns a value, so check it too.
|
// transfer actually returns a value, so check it too.
|
||||||
ok, _ := unwrap.Bool(res, nil)
|
ok, _ := unwrap.Bool(res, nil)
|
||||||
if ok {
|
if ok {
|
||||||
// OK, as expected. res.Script contains the corresponding
|
// OK, as expected.
|
||||||
// script and res.GasConsumed has an appropriate system fee
|
// res.Script contains the corresponding script.
|
||||||
// required for a transaction.
|
_ = res.Script
|
||||||
|
// res.GasConsumed has an appropriate system fee required for a transaction.
|
||||||
|
_ = res.GasConsumed
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,17 +34,17 @@ func ExampleBuilder() {
|
||||||
// Actor has an Invoker inside, so we can perform test invocation using the script.
|
// Actor has an Invoker inside, so we can perform test invocation using the script.
|
||||||
res, _ := a.Run(script)
|
res, _ := a.Run(script)
|
||||||
if res.State != "HALT" || len(res.Stack) != 2 {
|
if res.State != "HALT" || len(res.Stack) != 2 {
|
||||||
// The script failed completely or didn't return proper number of return values.
|
panic("failed") // The script failed completely or didn't return proper number of return values.
|
||||||
}
|
}
|
||||||
|
|
||||||
transferResult, _ := res.Stack[0].TryBool()
|
transferResult, _ := res.Stack[0].TryBool()
|
||||||
voteResult, _ := res.Stack[1].TryBool()
|
voteResult, _ := res.Stack[1].TryBool()
|
||||||
|
|
||||||
if !transferResult {
|
if !transferResult {
|
||||||
// Transfer failed.
|
panic("transfer failed")
|
||||||
}
|
}
|
||||||
if !voteResult {
|
if !voteResult {
|
||||||
// Vote failed.
|
panic("vote failed")
|
||||||
}
|
}
|
||||||
|
|
||||||
b.Reset() // Copy the old script above if you need it!
|
b.Reset() // Copy the old script above if you need it!
|
||||||
|
|
Loading…
Reference in a new issue