-
Notifications
You must be signed in to change notification settings - Fork 471
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
Upgrade golangci lint 1.39.0 #2198
Upgrade golangci lint 1.39.0 #2198
Conversation
Signed-off-by: Marcos Yacob <marcos.yacob@hpe.com>
Signed-off-by: Marcos Yacob <marcos.yacob@hpe.com>
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.
Awesome. Thanks @MarcosDY. Many of the new linters look good. Maybe we can decide which ones we want to apply and then open up a PR one at a time, introducing the new linter and the changes associated with that linter?
pkg/common/util/task_test.go
Outdated
@@ -86,9 +86,9 @@ func TestRunTaskCancelsTasksIfContextCanceled(t *testing.T) { | |||
assertErrorChan(t, out2, context.Canceled) | |||
} | |||
|
|||
///////////////////////////////////////////////////////////////////////////// | |||
// /////////////////////////////////////////////////////////////////////////// |
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.
gross. we should just get rid of the comment block.
pkg/server/endpoints/endpoints.go
Outdated
@@ -185,7 +185,7 @@ func (e *Endpoints) ListenAndServe(ctx context.Context) error { | |||
} | |||
|
|||
func (e *Endpoints) createTCPServer(ctx context.Context, unaryInterceptor grpc.UnaryServerInterceptor, streamInterceptor grpc.StreamServerInterceptor) *grpc.Server { | |||
tlsConfig := &tls.Config{ | |||
tlsConfig := &tls.Config{ //nolint: gosec // False positive, getTLSConfig is setting MinVerion |
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.
typo on MinVersion
@@ -83,7 +83,7 @@ func configureConnection(cfg *configuration, isReadOnly bool) (string, error) { | |||
return connectionString, nil | |||
} | |||
|
|||
tlsConf := tls.Config{} | |||
tlsConf := tls.Config{} //nolint: gosec // There are scenaries where MySQL requires older tls version, and example is when compiled with yaSSL that supports only TLSv1 and TLSv1.1 protocols. |
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.
tlsConf := tls.Config{} //nolint: gosec // There are scenaries where MySQL requires older tls version, and example is when compiled with yaSSL that supports only TLSv1 and TLSv1.1 protocols. | |
// MySQL still allows, and in some places requires, older TLS versions. For example, when built with yaSSL, it is limited to TLSv1 and TLSv1.1. | |
// TODO: consider making this more secure by default | |
tlsConf := tls.Config{} //nolint: gosec // see above |
@@ -29,7 +29,7 @@ import ( | |||
"k8s.io/apimachinery/pkg/runtime" | |||
"k8s.io/client-go/kubernetes/scheme" | |||
"sigs.k8s.io/controller-runtime/pkg/client" | |||
"sigs.k8s.io/controller-runtime/pkg/client/fake" | |||
"sigs.k8s.io/controller-runtime/pkg/client/fake" // nolint: staticcheck // No longer deprectated in newer versions. |
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.
typo on deprecated
@@ -19,7 +19,7 @@ import ( | |||
"k8s.io/client-go/kubernetes/scheme" | |||
ctrl "sigs.k8s.io/controller-runtime" | |||
"sigs.k8s.io/controller-runtime/pkg/client" | |||
"sigs.k8s.io/controller-runtime/pkg/client/fake" | |||
"sigs.k8s.io/controller-runtime/pkg/client/fake" // nolint: staticcheck // No longer deprectated in newer versions. |
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.
typo on deprecated
@@ -18,7 +18,7 @@ import ( | |||
"k8s.io/client-go/kubernetes/scheme" | |||
ctrl "sigs.k8s.io/controller-runtime" | |||
"sigs.k8s.io/controller-runtime/pkg/client" | |||
"sigs.k8s.io/controller-runtime/pkg/client/fake" | |||
"sigs.k8s.io/controller-runtime/pkg/client/fake" // nolint: staticcheck // No longer deprectated in newer versions. |
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.
typo on deprecated
I like all of the linters that you've outlined as "Interesting" with maybe the exception of goheader. I'd love to hear @evan2645's thoughts on that. We've had discussions on per-file copyrights before. From the "maybe" column, there are a bunch there that would be a huge amount of work to support. In general I like most of them, but I'm not sure the amount of churn required to get them to lint clean would be worth it. Particularly the error wrapping related ones and the |
agree |
Signed-off-by: Marcos Yacob <marcos.yacob@hpe.com>
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.
Thanks, @MarcosDY !
I applied changes to make lints pass, but there are some cases that we must highlight
exportloopref
I didn't add new lints to existing list, but I did a summary with list of lints that looks useful
I divide it in 2 lists:
must
list but they will require several changes that I'm not sure we really want.Interesting
scopelint
)Maybe
default
on switch)f
at the endexpected
)