-
Notifications
You must be signed in to change notification settings - Fork 394
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
Bump golangci-lint to v2.0.2 #5721
Bump golangci-lint to v2.0.2 #5721
Conversation
69ff9d8
to
41ea30e
Compare
41ea30e
to
ba7c0fa
Compare
ba7c0fa
to
106a006
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.
Would be cool if the comments in the linter config could be preserved, and if the dependency changes could be backed out.
I'm a bit on the fence about the ban on using embedded structs to name fields. I think it can sometimes help when reading code. WDYT?
go.mod
Outdated
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.
Not sure why we need to change the dependencies here.
@@ -46,13 +46,13 @@ func (s *NetworkSuite) TestAddresses() { | |||
s.Run("DNS_service_cidr_too_narrow", func() { | |||
n := Network{ServiceCIDR: "192.168.178.0/31"} | |||
dns, err := n.DNSAddress() | |||
s.Zero(dns) | |||
s.Empty(dns) |
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.
Hmm, I kinda disagree here. When testing error conditions for functions that return (T, error)
, I want to assert that the returned T
is the zero value of T
, even if T
happens to be a type that can be "empty". But, well, linters... 🤷
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.
Not a big fan of it either to be honest...
@@ -36,7 +36,7 @@ func (s *services) Run() error { | |||
var errs []error | |||
|
|||
for _, role := range []string{"controller", "worker"} { | |||
if err := install.UninstallService(role); err != nil && !(errors.Is(err, fs.ErrNotExist) || isExitCode(err, 1)) { | |||
if err := install.UninstallService(role); err != nil && (!errors.Is(err, fs.ErrNotExist) && !isExitCode(err, 1)) { |
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 think the parenthesis are no longer required now?
if err := install.UninstallService(role); err != nil && (!errors.Is(err, fs.ErrNotExist) && !isExitCode(err, 1)) { | |
if err := install.UninstallService(role); err != nil && !errors.Is(err, fs.ErrNotExist) && !isExitCode(err, 1) { |
t.Setenv(key, "") | ||
os.Unsetenv(key) |
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 see what you did there, but I think it's a bit hard to grasp. Would you mind to add a comment as to why the t.Setenv call is there?
OTOH, I have seen this test pop up in linter runs more than once. It might be worthwhile to nuke the dependency on os.Environ
in the function being tested and pass the environment as a string slice argument instead. This would allow the above code to be removed.
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 added a comment, I'm not opposed to the idea of passing a string slice with the environ though.
Bump golangci-lint to v2.0.2 and fix all the new linter errors. * Some if statements were rewritten according to the De Morgan's law. * TestGetEnv environment variable cleanup was rewritten to avoid calling os.SetEnv * --out-format=github-actions was deprecated for a while and was removed in 2.0.0 Co-authored-by: Tom Wieczorek <[email protected]> Signed-off-by: Juan-Luis de Sousa-Valadas Castaño <[email protected]>
113eb03
to
c624889
Compare
I added all the suggestions and commented |
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.
Can you maybe back out the go.mod/go.sum changes, as they don't seem to be related to the linter bump?
Unfortunately I can't, the original PR didn't have it, but for some reason without it the lint workflow fails. Since all the changes look like harmless bumps I didn't look further into it and just bumped them. |
Weird! How would changing the linter affect this? But, then again, linters ... 🤷 🙈 |
Description
Bump golangci-lint to v2.0.2 and fix all the new linter errors.
Type of change
How Has This Been Tested?
Checklist