Remove hardcoded execution count in benchmark functions
- Dominant language
- Go
- Stars
- 1.1k
- Forks
- 273
- Avg merge
- 4h 12m
- Merged PRs (30d)
- 10
Description
## Description
Found [staticcheck SA3001](https://staticcheck.dev/docs/checks/#SA3001) violation in `rawnode_test.go` :
```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.:
```bash
go test -bench=BenchmarkRawNodeImpl -benchtime=1x
```
## Impact
This change ensures benchmark results are accurate and aligns with Go's testing best practices.
Contributor guide
No contributing guide indexed for this repository
Research direction
Open rawnode_test.go and inspect benchmarkRawNodeImpl for the hardcoded b.N assignment. Run the benchmark with go test -bench=BenchmarkRawNodeImpl -benchtime=1x, and verify that the execution count is controlled by the command rather than the function body; the staticcheck SA3001 violation should also be resolved.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- testing-qa
- Issue type
- Refactor
- Difficulty
- 1/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100