-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
fix assorted oddities found by golangci-lint #1040
Conversation
@@ -40,10 +40,8 @@ type apiTest struct { | |||
inRes interface{} | |||
|
|||
reqPath string | |||
reqParam url.Values |
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.
Why are we removing these? Are they not used? Maybe there's something needs to be fixed in these tests.
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.
They are entirely unused, just like warnings
was. It seemed there were other mechanisms in place to construct the request params (using the do
field in each testcase)
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.
But I was also surprised that this amount of dead code would be here, so maybe the linter and me misinterpreted something? :)
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.
We might have changed the comparison method or something similar without realizing their intended use. Let's make sure if we can actually use them. Otherwise, happy to accept clean-ups.
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.
So from what I can see, the apiTest
structure was introduced via #165 (released in v0.8.0). However I could not find a single revision in this repo that actually used the reqParam
field.
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.
That's an ancient PR 😅 Thanks for digging it up. Then I'm ok with the changes. If anything becomes broken, we can fix them on consecutive PRs.
@xrstf One last could you please let me know which linters have you used for these changes? It would be even better if you update the |
No problemo. I first only fixed the low hanging fruit, as I did not intend for the linters to be enabled permanently. But if you want, gladly, we can make them permanent. I pushed a commit to enable them and fix the remaining not-so-low-hanging fruit. :) |
Not super sure about the Github action failing, I have the exact same golangci-lint version locally and it finishes without issues. |
@kakkoyun Can do :) |
@xrstf Do you think you can check this out this week? We want to cut a release. |
Signed-off-by: Christoph Mewes <[email protected]>
Signed-off-by: Christoph Mewes <[email protected]>
Signed-off-by: Christoph Mewes <[email protected]>
I can! In the meaintime there was #1047, but I still assume that since the reqParams are unused, I can still remove them in this PR? |
Are the test failures are flakes? Locally |
It seems like it :) Now, it is fixed. |
This PR fixes a lot of the errors found by various linters in golangci-lint, mostly focussing on
==
or type assertions anymore, buterrors.Is()
anderrors.As()
are used.strings.Replace(_, _, _, -1)
==strings.ReplaceAll(_, _, _)
string(buf.Bytes())
==buf.String()
if strings.HasSuffix(a, b) { trim suffix }
==strings.TrimSuffix()
reqParam
andwarnings
in the unit tests were entirely unused.