diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2021-04-21 09:41:26 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2021-04-23 11:42:56 +0300 |
commit | d6b658f9a4bf92855c55cd4e2240b79942c13dbe (patch) | |
tree | 7b7f2c57ccf8197b7c9d30d8068f98aa147a482e | |
parent | 99cf654a47e6ffa1d8827060a3fe5772c7f6320f (diff) |
golangci: Enable wastedassign linter
The wastedassign linter will check whether a newly assigned variable is
used in any code path after its assignment. This seems like a useful
check to have, e.g. to not forget checking a reassigned error value.
Enable the linter and fix the single violation it surfaces.
-rw-r--r-- | .golangci.yml | 1 | ||||
-rw-r--r-- | internal/praefect/nodes/manager_test.go | 2 |
2 files changed, 2 insertions, 1 deletions
diff --git a/.golangci.yml b/.golangci.yml index 7ce33a0d0..8239b4bed 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -28,6 +28,7 @@ linters: - unconvert - unused - varcheck + - wastedassign issues: exclude-use-default: false diff --git a/internal/praefect/nodes/manager_test.go b/internal/praefect/nodes/manager_test.go index dac640310..a550049de 100644 --- a/internal/praefect/nodes/manager_test.go +++ b/internal/praefect/nodes/manager_test.go @@ -137,7 +137,7 @@ func TestManagerFailoverDisabledElectionStrategySQL(t *testing.T) { healthSrv.SetServingStatus("", grpc_health_v1.HealthCheckResponse_UNKNOWN) nm.checkShards() - shard, err = nm.GetShard(ctx, virtualStorageName) + _, err = nm.GetShard(ctx, virtualStorageName) require.Error(t, err) require.Equal(t, ErrPrimaryNotHealthy, err) } |