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

🌱 Add loggercheck linter and fix findings #9446

Merged
merged 1 commit into from
Sep 18, 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
1 change: 1 addition & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ linters:
- govet
- importas
- ineffassign
- loggercheck
Copy link
Member Author

@sbueringer sbueringer Sep 18, 2023

Choose a reason for hiding this comment

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

Validates for complete k/v pairs (i.e. we get a finding if we have an odd number of arguments)

Example

test/infrastructure/docker/internal/docker/manager.go:175:46: odd number of arguments passed as key-value pairs for logging (loggercheck)
        log.V(6).Info("Container run options: %+v", runOptions)
                                                    ^

- misspell
- nakedret
- nilerr
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func (r *Reconciler) reconcileOldMachineSetsOnDelete(ctx context.Context, oldMSs
}
selectorMap, err := metav1.LabelSelectorAsMap(&oldMS.Spec.Selector)
if err != nil {
log.V(4).Error(err, "failed to convert MachineSet %q label selector to a map", oldMS.Name)
log.V(4).Error(err, "failed to convert MachineSet label selector to a map")
continue
}
log.V(4).Info("Fetching Machines associated with MachineSet")
Expand Down
2 changes: 1 addition & 1 deletion test/infrastructure/docker/internal/docker/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ func createNode(ctx context.Context, opts *nodeCreateOpts) (*types.Node, error)
}
}

log.V(6).Info("Container run options: %+v", runOptions)
log.V(6).Info(fmt.Sprintf("Container run options: %+v", runOptions))
sbueringer marked this conversation as resolved.
Show resolved Hide resolved

containerRuntime, err := container.RuntimeFrom(ctx)
if err != nil {
Expand Down