Skip to content

Remove hardcoded execution count in benchmark functions #313

@nu1lspaxe

Description

@nu1lspaxe

Description

Found staticcheck SA3001 violation in rawnode_test.go :

func benchmarkRawNodeImpl(b *testing.B, peers ...uint64) {
        // ...
	if debug {
		b.N = 1
	}
        // ...
}

Proposed Fix

Instead of hardcoding b.N in the function body, the execution count should be controlled via the go test command, e.g.:

go test -bench=BenchmarkRawNodeImpl -benchtime=1x

Impact

This change ensures benchmark results are accurate and aligns with Go's testing best practices.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions