Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Org-wide linter #2943

Draft
wants to merge 18 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 8 additions & 16 deletions pkg/local_object_storage/pilorama/forest_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package pilorama

import (
crand "crypto/rand"
"fmt"
"math/rand"
"math/rand/v2"
"os"
"path/filepath"
"strconv"
Expand Down Expand Up @@ -684,7 +685,7 @@ func prepareRandomTree(nodeCount, opCount int) []Move {
Child: uint64(i) + 1,
}
//nolint:staticcheck
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drop these comments then?

rand.Read(ops[i].Meta.Items[1].Value)
_, _ = crand.Read(ops[i].Meta.Items[1].Value)
}

for i := nodeCount; i < len(ops); i++ {
Expand All @@ -703,7 +704,7 @@ func prepareRandomTree(nodeCount, opCount int) []Move {
ops[i].Parent = TrashID
}
//nolint:staticcheck
rand.Read(ops[i].Meta.Items[1].Value)
_, _ = crand.Read(ops[i].Meta.Items[1].Value)
}

return ops
Expand Down Expand Up @@ -741,9 +742,6 @@ func compareForests(t *testing.T, expected, actual Forest, cid cidSDK.ID, treeID
}

func testForestTreeParallelApply(t *testing.T, constructor func(t testing.TB, _ ...Option) Forest, batchSize, opCount, iterCount int) {
//nolint:staticcheck
rand.Seed(42)

const nodeCount = 5

ops := prepareRandomTree(nodeCount, opCount)
Expand Down Expand Up @@ -785,9 +783,6 @@ func testForestTreeParallelApply(t *testing.T, constructor func(t testing.TB, _
}

func testForestTreeApplyRandom(t *testing.T, constructor func(t testing.TB, _ ...Option) Forest) {
//nolint:staticcheck
rand.Seed(42)

const (
nodeCount = 5
opCount = 20
Expand Down Expand Up @@ -834,12 +829,12 @@ func BenchmarkApplySequential(b *testing.B) {
ops := make([]Move, opCount)
for i := range ops {
ops[i] = Move{
Parent: uint64(rand.Intn(benchNodeCount)),
Parent: uint64(rand.IntN(benchNodeCount)),
Meta: Meta{
Time: Timestamp(i),
Items: []KeyValue{{Value: []byte{0, 1, 2, 3, 4}}},
},
Child: uint64(rand.Intn(benchNodeCount)),
Child: uint64(rand.IntN(benchNodeCount)),
}
}
return ops
Expand Down Expand Up @@ -867,12 +862,12 @@ func BenchmarkApplyReorderLast(b *testing.B) {
ops := make([]Move, opCount)
for i := range ops {
ops[i] = Move{
Parent: uint64(rand.Intn(benchNodeCount)),
Parent: uint64(rand.IntN(benchNodeCount)),
Meta: Meta{
Time: Timestamp(i),
Items: []KeyValue{{Value: []byte{0, 1, 2, 3, 4}}},
},
Child: uint64(rand.Intn(benchNodeCount)),
Child: uint64(rand.IntN(benchNodeCount)),
}
if i != 0 && i%blockSize == 0 {
for j := range blockSize / 2 {
Expand All @@ -889,9 +884,6 @@ func BenchmarkApplyReorderLast(b *testing.B) {
}

func benchmarkApply(b *testing.B, s Forest, genFunc func(int) []Move) {
//nolint:staticcheck
rand.Seed(42)

ops := genFunc(b.N)
cid := cidtest.ID()
d := CIDDescriptor{cid, 0, 1}
Expand Down
2 changes: 1 addition & 1 deletion pkg/services/object/put/proto_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package putsvc

import (
"math/rand"
"crypto/rand"
"testing"

objectv2 "github.com/nspcc-dev/neofs-api-go/v2/object"
Expand Down