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

chore(*): enable nilerr, unparam linter #396

Merged
merged 1 commit into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
12 changes: 8 additions & 4 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,22 +40,22 @@ linters:
# - gomoddirectives
# - gosec
- nakedret
# - nilerr
- nilerr
# - nilnil
# - noctx
- nolintlint
- prealloc
- predeclared
- promlinter
# - reassign
- reassign
- rowserrcheck
- sqlclosecheck
- tenv
# - testableexamples
# - thelper
- tparallel
- unconvert
# - unparam
- unparam
- usestdlibvars
- wastedassign

Expand All @@ -66,4 +66,8 @@ linters-settings:
ignore-tests: true

issues:
fix: true
fix: true
exclude-rules:
- path: _test\.go
linters:
- unparam
1 change: 1 addition & 0 deletions common/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ func ParseLogLevel(levelStr string) (slog.Level, error) {

func ConfigureLogger() {
zerolog.TimeFieldFormat = time.RFC3339Nano
//nolint
zerolog.ErrorStackMarshaler = pkgerrors.MarshalStack

protoMarshal := protojson.MarshalOptions{
Expand Down
1 change: 1 addition & 0 deletions coordinator/impl/coordinator.go
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,7 @@ func (c *coordinator) handleClusterConfigUpdated() error {
return nil
}

//nolint:unparam
func (c *coordinator) rebalanceCluster() error {
c.Lock()
actions := rebalanceCluster(c.ClusterConfig.Servers, c.clusterStatus)
Expand Down
1 change: 1 addition & 0 deletions coordinator/impl/k8s_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ func K8SResourceVersionSupport(tracker testing.ObjectTracker) testing.ReactionFu
objMeta := accessor(action.GetObject())
existing, err := tracker.Get(gvr, ns, objMeta.GetName())
if err != nil {
//nolint:nilerr
return false, action.GetObject(), nil
}
existingObjMeta := accessor(existing)
Expand Down
4 changes: 2 additions & 2 deletions coordinator/impl/metadata_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ var (
return f
}()
metadataProviders = map[string]func(t *testing.T) MetadataProvider{
"memory": func(t *testing.T) MetadataProvider {
"memory": func(_ *testing.T) MetadataProvider {
return NewMetadataProviderMemory()
},
"file": func(t *testing.T) MetadataProvider {
return NewMetadataProviderFile(filepath.Join(t.TempDir(), "metadata"))
},
"configmap": func(t *testing.T) MetadataProvider {
"configmap": func(_ *testing.T) MetadataProvider {
return NewMetadataProviderConfigMap(_fake, "ns", "n")
},
}
Expand Down
1 change: 1 addition & 0 deletions server/wal/wal_rw_segment.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ func (ms *readWriteSegment) Flush() error {
return ms.txnMappedFile.Flush()
}

//nolint:unparam
func (ms *readWriteSegment) rebuildIdx() error {
// Scan the mapped file and rebuild the index

Expand Down
Loading