all: fix invalid directive syntax for golangci-lint nolint (#1799)

This commit is contained in:
wit liu 2025-12-08 15:32:54 +08:00 committed by GitHub
parent bfbb024dc4
commit ea3a55aef4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 14 additions and 10 deletions

View file

@ -39,7 +39,7 @@ import (
func TestSimulatedBackend(t *testing.T) { func TestSimulatedBackend(t *testing.T) {
t.Parallel() t.Parallel()
var gasLimit uint64 = 8000029 var gasLimit uint64 = 8000029
key, _ := crypto.GenerateKey() // nolint: gosec key, _ := crypto.GenerateKey() //nolint:gosec
auth, _ := bind.NewKeyedTransactorWithChainID(key, big.NewInt(1337)) auth, _ := bind.NewKeyedTransactorWithChainID(key, big.NewInt(1337))
genAlloc := make(types.GenesisAlloc) genAlloc := make(types.GenesisAlloc)
genAlloc[auth.From] = types.Account{Balance: big.NewInt(9223372036854775807)} genAlloc[auth.From] = types.Account{Balance: big.NewInt(9223372036854775807)}

View file

@ -53,7 +53,7 @@ func TestKeyEncryptDecrypt(t *testing.T) {
t.Errorf("test %d: key address mismatch: have %x, want %x", i, key.Address, address) t.Errorf("test %d: key address mismatch: have %x, want %x", i, key.Address, address)
} }
// Recrypt with a new password and start over // Recrypt with a new password and start over
password += "new data appended" // nolint: gosec password += "new data appended" //nolint:gosec
if keyjson, err = EncryptKey(key, password, veryLightScryptN, veryLightScryptP); err != nil { if keyjson, err = EncryptKey(key, password, veryLightScryptN, veryLightScryptP); err != nil {
t.Errorf("test %d: failed to re-encrypt key %v", i, err) t.Errorf("test %d: failed to re-encrypt key %v", i, err)
} }

View file

@ -25,7 +25,7 @@ var precomputed = [10][16]byte{
{10, 8, 7, 1, 2, 4, 6, 5, 15, 9, 3, 13, 11, 14, 12, 0}, {10, 8, 7, 1, 2, 4, 6, 5, 15, 9, 3, 13, 11, 14, 12, 0},
} }
// nolint:unused //nolint:unused
func hashBlocksGeneric(h *[8]uint64, c *[2]uint64, flag uint64, blocks []byte) { func hashBlocksGeneric(h *[8]uint64, c *[2]uint64, flag uint64, blocks []byte) {
var m [16]uint64 var m [16]uint64
c0, c1 := c[0], c[1] c0, c1 := c[0], c[1]

View file

@ -66,7 +66,7 @@ func (g *GoToolchain) goTool(command string, args ...string) *exec.Cmd {
if g.Root == "" { if g.Root == "" {
g.Root = runtime.GOROOT() g.Root = runtime.GOROOT()
} }
tool := exec.Command(filepath.Join(g.Root, "bin", "go"), command) // nolint: gosec tool := exec.Command(filepath.Join(g.Root, "bin", "go"), command) //nolint:gosec
tool.Args = append(tool.Args, args...) tool.Args = append(tool.Args, args...)
tool.Env = append(tool.Env, "GOROOT="+g.Root) tool.Env = append(tool.Env, "GOROOT="+g.Root)

View file

@ -35,18 +35,21 @@ type memoryNode struct {
// memoryNodeSize is the raw size of a memoryNode data structure without any // memoryNodeSize is the raw size of a memoryNode data structure without any
// node data included. It's an approximate size, but should be a lot better // node data included. It's an approximate size, but should be a lot better
// than not counting them. // than not counting them.
// nolint:unused //
//nolint:unused
var memoryNodeSize = int(reflect.TypeOf(memoryNode{}).Size()) var memoryNodeSize = int(reflect.TypeOf(memoryNode{}).Size())
// memorySize returns the total memory size used by this node. // memorySize returns the total memory size used by this node.
// nolint:unused //
//nolint:unused
func (n *memoryNode) memorySize(key int) int { func (n *memoryNode) memorySize(key int) int {
return int(n.size) + memoryNodeSize + key return int(n.size) + memoryNodeSize + key
} }
// rlp returns the raw rlp encoded blob of the cached trie node, either directly // rlp returns the raw rlp encoded blob of the cached trie node, either directly
// from the cache, or by regenerating it from the collapsed node. // from the cache, or by regenerating it from the collapsed node.
// nolint:unused //
//nolint:unused
func (n *memoryNode) rlp() []byte { func (n *memoryNode) rlp() []byte {
if node, ok := n.node.(rawNode); ok { if node, ok := n.node.(rawNode); ok {
return node return node
@ -56,7 +59,8 @@ func (n *memoryNode) rlp() []byte {
// obj returns the decoded and expanded trie node, either directly from the cache, // obj returns the decoded and expanded trie node, either directly from the cache,
// or by regenerating it from the rlp encoded blob. // or by regenerating it from the rlp encoded blob.
// nolint:unused //
//nolint:unused
func (n *memoryNode) obj() node { func (n *memoryNode) obj() node {
if node, ok := n.node.(rawNode); ok { if node, ok := n.node.(rawNode); ok {
return mustDecodeNode(n.hash[:], node) return mustDecodeNode(n.hash[:], node)
@ -71,14 +75,14 @@ type nodeWithPrev struct {
} }
// unwrap returns the internal memoryNode object. // unwrap returns the internal memoryNode object.
// nolint:unused //nolint:unused
func (n *nodeWithPrev) unwrap() *memoryNode { func (n *nodeWithPrev) unwrap() *memoryNode {
return n.memoryNode return n.memoryNode
} }
// memorySize returns the total memory size used by this node. It overloads // memorySize returns the total memory size used by this node. It overloads
// the function in memoryNode by counting the size of previous value as well. // the function in memoryNode by counting the size of previous value as well.
// nolint: unused //nolint: unused
func (n *nodeWithPrev) memorySize(key int) int { func (n *nodeWithPrev) memorySize(key int) int {
return n.memoryNode.memorySize(key) + len(n.prev) return n.memoryNode.memorySize(key) + len(n.prev)
} }