*: fix all unused
warnings
From golangci-lint.
This commit is contained in:
parent
de5e61588d
commit
92dbb3c4b9
5 changed files with 4 additions and 50 deletions
|
@ -1521,33 +1521,6 @@ func getJumpForToken(tok token.Token, typ types.Type) (opcode.Opcode, bool) {
|
|||
return 0, false
|
||||
}
|
||||
|
||||
// getByteArray returns byte array value from constant expr.
|
||||
// Only literals are supported.
|
||||
func (c *codegen) getByteArray(expr ast.Expr) []byte {
|
||||
switch t := expr.(type) {
|
||||
case *ast.CompositeLit:
|
||||
if !isByteSlice(c.typeOf(t.Type)) {
|
||||
return nil
|
||||
}
|
||||
buf := make([]byte, len(t.Elts))
|
||||
for i := 0; i < len(t.Elts); i++ {
|
||||
t := c.typeAndValueOf(t.Elts[i])
|
||||
val, _ := constant.Int64Val(t.Value)
|
||||
buf[i] = byte(val)
|
||||
}
|
||||
return buf
|
||||
case *ast.CallExpr:
|
||||
if tv := c.typeAndValueOf(t.Args[0]); tv.Value != nil {
|
||||
val := constant.StringVal(tv.Value)
|
||||
return []byte(val)
|
||||
}
|
||||
|
||||
return nil
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func (c *codegen) convertSyscall(f *funcScope, expr *ast.CallExpr) {
|
||||
for _, arg := range expr.Args[1:] {
|
||||
ast.Walk(c, arg)
|
||||
|
|
|
@ -277,6 +277,8 @@ func TestTrie_PutBatch(t *testing.T) {
|
|||
testPut(t, ps, tr1, tr2)
|
||||
}
|
||||
|
||||
var _ = printNode
|
||||
|
||||
// This function is unused, but is helpful for debugging
|
||||
// as it provides more readable Trie representation compared to
|
||||
// `spew.Dump()`
|
||||
|
|
|
@ -711,17 +711,6 @@ func (sl stringList) index(s string) (int, bool) {
|
|||
return index, index < len(sl) && sl[index] == s
|
||||
}
|
||||
|
||||
func (sl *stringList) remove(s string) bool {
|
||||
index, has := sl.index(s)
|
||||
if !has {
|
||||
return false
|
||||
}
|
||||
|
||||
copy((*sl)[index:], (*sl)[index+1:])
|
||||
*sl = (*sl)[:len(*sl)-1]
|
||||
return true
|
||||
}
|
||||
|
||||
func (sl *stringList) add(s string) bool {
|
||||
index, has := sl.index(s)
|
||||
if has {
|
||||
|
|
|
@ -305,6 +305,8 @@ func (n *nonfungible) postTransfer(ic *interop.Context, from, to *util.Uint160,
|
|||
}
|
||||
}
|
||||
|
||||
var _ = (*nonfungible).burn // fix unused warning
|
||||
|
||||
func (n *nonfungible) burn(ic *interop.Context, tokenID []byte) {
|
||||
key := n.getTokenKey(tokenID)
|
||||
n.burnByKey(ic, key)
|
||||
|
|
|
@ -117,15 +117,3 @@ func finalizeTx(oracleNodes keys.PublicKeys, tx *transaction.Transaction, txSigs
|
|||
tx.Scripts[1].InvocationScript = w.Bytes()
|
||||
return true
|
||||
}
|
||||
|
||||
func (t *incompleteTx) getRequest() *state.OracleRequest {
|
||||
t.RLock()
|
||||
defer t.RUnlock()
|
||||
return t.request
|
||||
}
|
||||
|
||||
func (t *incompleteTx) getTime() time.Time {
|
||||
t.RLock()
|
||||
defer t.RUnlock()
|
||||
return t.time
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue