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
2 changes: 1 addition & 1 deletion pkg/innerring/nns_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func (x *testInvoker) TraverseIterator(sessionID uuid.UUID, iterator *result.Ite

func TestNeoFSNNS_CheckDomainRecord(t *testing.T) {
var contractAddr util.Uint160
rand.Read(contractAddr[:])
_, _ = rand.Read(contractAddr[:])
const domain = "l2.l1.tld"
searchedRecord := "abcdef"

Expand Down
4 changes: 2 additions & 2 deletions pkg/local_object_storage/blobstor/bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func newTestFSTree(tb testing.TB) common.Storage {

func benchmark(b *testing.B, p common.Storage, objSize uint64, nThreads int) {
data := make([]byte, objSize)
rand.Read(data)
_, _ = rand.Read(data)

prm := common.PutPrm{
RawData: data,
Expand Down Expand Up @@ -130,7 +130,7 @@ func BenchmarkGet(b *testing.B) {

obj := object.New()
data := make([]byte, tc.objSize)
rand.Read(data)
_, _ = rand.Read(data)
obj.SetID(oid.ID{1, 2, 3})
obj.SetContainerID(cid.ID{1, 2, 3})
obj.SetPayload(data)
Expand Down
2 changes: 1 addition & 1 deletion pkg/local_object_storage/blobstor/common/storage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func TestCopy(t *testing.T) {
for range nObjects {
addr := oidtest.Address()
data := make([]byte, 32)
rand.Read(data)
_, _ = rand.Read(data)
mObjs[addr] = data

_, err := src.Put(common.PutPrm{
Expand Down
4 changes: 2 additions & 2 deletions pkg/local_object_storage/blobstor/compression/bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func BenchmarkCompression(b *testing.B) {
})
b.Run("random slice", func(b *testing.B) {
data := make([]byte, size)
rand.Read(data)
_, _ = rand.Read(data)
benchWith(b, c, data)
})
})
Expand All @@ -41,7 +41,7 @@ func benchWith(b *testing.B, c Config, data []byte) {

func notSoRandomSlice(size, blockSize int) []byte {
data := make([]byte, size)
rand.Read(data[:blockSize])
_, _ = rand.Read(data[:blockSize])
for i := blockSize; i < size; i += blockSize {
copy(data[i:], data[:blockSize])
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/local_object_storage/shard/metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ func TestCounters(t *testing.T) {
dir := t.TempDir()
sh, mm := shardWithMetrics(t, dir)

sh.SetMode(mode.ReadOnly)
_ = sh.SetMode(mode.ReadOnly)
Copy link
Member

Choose a reason for hiding this comment

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

Can be checked with require.NoError()

require.True(t, mm.readOnly)
sh.SetMode(mode.ReadWrite)
_ = sh.SetMode(mode.ReadWrite)
require.False(t, mm.readOnly)

const objNumber = 10
Expand Down
8 changes: 4 additions & 4 deletions pkg/services/object/get/get_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ func TestGetLocalOnly(t *testing.T) {

payloadSz := uint64(10)
payload := make([]byte, payloadSz)
rand.Read(payload)
_, _ = rand.Read(payload)

addr := oidtest.Address()
obj := generateObject(addr, nil, payload)
Expand Down Expand Up @@ -429,7 +429,7 @@ func testNodeMatrix(t testing.TB, dim []int) ([][]netmap.NodeInfo, [][]string) {
)

bPubKey := make([]byte, 33)
rand.Read(bPubKey)
_, _ = rand.Read(bPubKey)

var ni netmap.NodeInfo
ni.SetNetworkEndpoints(a)
Expand Down Expand Up @@ -468,7 +468,7 @@ func generateChain(ln int, cnr cid.ID) ([]*objectSDK.Object, []oid.ID, []byte) {
addr.SetObject(curID)

payloadPart := make([]byte, 10)
rand.Read(payloadPart)
_, _ = rand.Read(payloadPart)

o := generateObject(addr, prevID, []byte{byte(i)})
o.SetPayload(payloadPart)
Expand Down Expand Up @@ -558,7 +558,7 @@ func TestGetRemoteSmall(t *testing.T) {

payloadSz := uint64(10)
payload := make([]byte, payloadSz)
rand.Read(payload)
_, _ = rand.Read(payload)

obj := generateObject(addr, nil, payload)

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
Expand Up @@ -19,7 +19,7 @@ import (
func TestUnaryReplicateRequest(t *testing.T) {
// prepare replicated object
payload := make([]byte, 1024)
rand.Read(payload)
_, _ = rand.Read(payload)
obj := objecttest.Object()
obj.SetPayload(payload)
id := oidtest.ID()
Expand Down
4 changes: 2 additions & 2 deletions pkg/services/object/search/search_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ func (c *testStorage) addResult(addr cid.ID, ids []oid.ID, err error) {
}

func testSHA256() (cs [sha256.Size]byte) {
rand.Read(cs[:])
_, _ = rand.Read(cs[:])
return cs
}

Expand Down Expand Up @@ -213,7 +213,7 @@ func testNodeMatrix(t testing.TB, dim []int) ([][]netmap.NodeInfo, [][]string) {
)

bPubKey := make([]byte, 33)
rand.Read(bPubKey)
_, _ = rand.Read(bPubKey)

var ni netmap.NodeInfo
ni.SetNetworkEndpoints(a)
Expand Down