From 61b2592bff7749614b599f50466a5cee096771ef Mon Sep 17 00:00:00 2001 From: size12 Date: Wed, 24 Jan 2024 08:50:22 +0300 Subject: [PATCH 1/2] enabled golangci --- .golangci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.golangci.yml b/.golangci.yml index 79b64ebe4..e7696ee51 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -247,7 +247,6 @@ linters: - testpackage - thelper - varnamelen - - wastedassign - wrapcheck - wsl From a9ce335cd0c9996c55b77dff69d41e8638fd3ac6 Mon Sep 17 00:00:00 2001 From: size12 Date: Wed, 24 Jan 2024 08:55:54 +0300 Subject: [PATCH 2/2] fixed linter warnings --- internal/background/worker_test.go | 9 ++++----- internal/table/scanner/perfomance_test.go | 2 +- internal/topic/retriable_error.go | 2 -- internal/topic/topicwriterinternal/writer_reconnector.go | 2 +- table/options/models.go | 3 ++- 5 files changed, 8 insertions(+), 10 deletions(-) diff --git a/internal/background/worker_test.go b/internal/background/worker_test.go index f90ec6424..6a3c13748 100644 --- a/internal/background/worker_test.go +++ b/internal/background/worker_test.go @@ -106,8 +106,6 @@ func TestWorkerConcurrentStartAndClose(t *testing.T) { ctx := xtest.Context(t) w := NewWorker(ctx) - closeIndex := int64(0) - stopNewStarts := xatomic.Bool{} var wgStarters sync.WaitGroup for i := 0; i < parallel; i++ { @@ -134,11 +132,12 @@ func TestWorkerConcurrentStartAndClose(t *testing.T) { require.NoError(t, w.Close(xtest.ContextWithCommonTimeout(ctx, t), nil)) - closeIndex = counter.Load() - require.Equal(t, closeIndex, counter.Load()) - stopNewStarts.Store(true) xtest.WaitGroup(t, &wgStarters) + + _, ok := <-w.tasks + require.False(t, ok) + require.True(t, w.closed) }) } diff --git a/internal/table/scanner/perfomance_test.go b/internal/table/scanner/perfomance_test.go index 56ed18680..72378b6ce 100644 --- a/internal/table/scanner/perfomance_test.go +++ b/internal/table/scanner/perfomance_test.go @@ -123,7 +123,7 @@ func BenchmarkTestSliceIncrement(b *testing.B) { for j := 0; j < testSize; j++ { slice[j] = &column{} } - cnt := 0 + var cnt int var row column b.ResetTimer() for i := 0; i < b.N; i++ { diff --git a/internal/topic/retriable_error.go b/internal/topic/retriable_error.go index c750338cb..5d08b5087 100644 --- a/internal/topic/retriable_error.go +++ b/internal/topic/retriable_error.go @@ -65,8 +65,6 @@ func CheckRetryMode(err error, settings RetrySettings, retriesDuration time.Dura return nil, false } - isRetriable = true - mode := retry.Check(err) decision := PublicRetryDecisionDefault diff --git a/internal/topic/topicwriterinternal/writer_reconnector.go b/internal/topic/topicwriterinternal/writer_reconnector.go index c9b7ab48d..fcd1eabf7 100644 --- a/internal/topic/topicwriterinternal/writer_reconnector.go +++ b/internal/topic/topicwriterinternal/writer_reconnector.go @@ -351,7 +351,7 @@ func (w *WriterReconnector) connectionLoop(ctx context.Context) { return xcontext.WithCancel(xcontext.WithoutDeadline(ctx)) } - //nolint:ineffassign,staticcheck + //nolint:ineffassign,staticcheck,wastedassign streamCtx, streamCtxCancel := createStreamContext() defer streamCtxCancel() diff --git a/table/options/models.go b/table/options/models.go index ea93a53a0..2f285ad02 100644 --- a/table/options/models.go +++ b/table/options/models.go @@ -198,7 +198,8 @@ func (rr ReadReplicasSettings) ToYDB() *Ydb_Table.ReadReplicasSettings { } func NewReadReplicasSettings(rr *Ydb_Table.ReadReplicasSettings) ReadReplicasSettings { - t, c := ReadReplicasPerAzReadReplicas, uint64(0) + t := ReadReplicasPerAzReadReplicas + var c uint64 if c = rr.GetPerAzReadReplicasCount(); c != 0 { t = ReadReplicasPerAzReadReplicas