-
Notifications
You must be signed in to change notification settings - Fork 541
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
Integrate golangci-lint to run aggregate linting checks for CI #2536
Integrate golangci-lint to run aggregate linting checks for CI #2536
Conversation
a230fb4
to
3bddf9b
Compare
/wip |
Introduce a root .golangci-lint.yaml file to the repository. This file is responsible for housing the golangci-lint configuration, and the various aggregate linters that are enabled/disabled. Signed-off-by: timflannagan <timflannagan@gmail.com>
Update the sanity workflow and add the golangci-lint action. Signed-off-by: timflannagan <timflannagan@gmail.com>
e6c4850
to
4bccf66
Compare
- unconvert | ||
- whitespace | ||
disable: | ||
- errcheck |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing this can be done in a follow-up PR.
max-issues-per-linter: 0 | ||
max-same-issues: 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Setting both of these configuration options limit the number of linting violations that are discovered at a time. Setting the values to 0
disables that behavior.
@@ -69,7 +69,7 @@ var ( | |||
tlsCertPath = flag.String( | |||
"tls-cert", "", "Path to use for certificate key (requires tls-key)") | |||
|
|||
profiling = flag.Bool("profiling", false, "deprecated") | |||
_ = flag.Bool("profiling", false, "deprecated") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This flag is currently unused right now since we merge the profiling/metrics/health/etc. endpoints last minor release. I thought this was the easiest solution, vs. updating the .golangci-lint.yaml configuration and explicitly allowlisting this flag.
if err != nil { | ||
logger.WithError(err).Warn("failed to list operatorgroups") | ||
return | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: need to double-check whether this is the correct behavior. It wasn't clear to me poking around whether I should be returning a syncError here.
4bccf66
to
ca3bf61
Compare
- depguard | ||
- gofmt | ||
- goimports | ||
- importas |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to tackle adding a more fleshed out importas configuration ( e.g. enforcing consistency with corev1/metav1/operatorsv1alpha1/etc. package alias') as a follow-up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good. Just a quick question.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/approve
Signed-off-by: timflannagan <timflannagan@gmail.com>
ca3bf61
to
cd27f6d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/approve
Great work on this @timflannagan
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: awgreene, dinhxuanvu, timflannagan The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Description of the change:
Motivation for the change:
Reviewer Checklist
/doc