-
Notifications
You must be signed in to change notification settings - Fork 59
bump golangci-lint to v2.0.2 #225
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
base: main
Are you sure you want to change the base?
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/assign @RainbowMango @samzong |
hack/verify-staticcheck.sh
Outdated
@@ -19,7 +19,7 @@ set -o nounset | |||
set -o pipefail | |||
|
|||
REPO_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. | |||
GOLANGCI_LINT_VER="v1.59.0" | |||
GOLANGCI_LINT_VER="v1.64.2" |
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.
Shall we bump it to v2.0.2? consistent with [email protected] ?
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.
+1, I appreciate to upgrade golangci-lint
cmd/web/app/web.go
Outdated
@@ -123,7 +123,7 @@ func serve(opts *options.Options) { | |||
r.NoRoute(func(c *gin.Context) { | |||
indexHTML := "no content" | |||
indexPath := path.Join(opts.StaticDir, "index.html") | |||
f, err := os.Open(indexPath) | |||
f, err := os.Open(indexPath) // #nosec |
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.
It would be great if we can explain the false-positive warnings, like:
https://github.com/karmada-io/karmada/blob/d231a87aed73252a915a80edf48d96030036cb86/pkg/estimator/client/general.go#L69
Same as below.
.golangci.yml
Outdated
@@ -58,6 +58,7 @@ linters-settings: | |||
- name: if-return | |||
disabled: true | |||
- name: package-comments | |||
disabled: true |
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.
Maybe explain why this is disabled? Like:
https://github.com/karmada-io/karmada/blob/48bab1473cc78b009c137702ceff6c1fe9a7f829/.golangci.yml#L40-L42
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.
because I don't want to add package comments 😢 , currently, I accept the suggestion and prepare to enable the rule
.golangci.yml
Outdated
- (^|/)cmd/kubernetes-dashboard-api($|/) | ||
- (^|/)pkg/kubernetes-dashboard-common($|/) | ||
- (^|/)cmd/metrics-scraper($|/) |
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.
Just a question, why should these directories be excluded?
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.
for further lift code from kubernetes dashboard api, I split the changes into two PRs
cmd/web/app/web.go
Outdated
@@ -123,7 +123,7 @@ func serve(opts *options.Options) { | |||
r.NoRoute(func(c *gin.Context) { | |||
indexHTML := "no content" | |||
indexPath := path.Join(opts.StaticDir, "index.html") | |||
f, err := os.Open(indexPath) | |||
f, err := os.Open(indexPath) // #nosec |
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.
f, err := os.Open(indexPath) // #nosec | |
if err := validatePath(indexPath); err != nil { | |
return err | |
} | |
f, err := os.Open(indexPath) |
.golangci.yml
Outdated
@@ -58,6 +58,7 @@ linters-settings: | |||
- name: if-return | |||
disabled: true | |||
- name: package-comments | |||
disabled: true |
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 suggest not.
violates Go standards, It's should fix issues, not suppress.
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 suggest not.
violates Go standards, It's should fix issues, not suppress.
agree with your advice, so I decide to enable package-comments
rule
/retitle bump golangci-lint to v2.0.2 |
Signed-off-by: warjiang <[email protected]>
Signed-off-by: warjiang <[email protected]>
What type of PR is this?
v1.64.2
package-comments
inrevive
/kind feature
What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?: