Merged
Conversation
gofumpt is basically a stricter/better gofmt. It is supported by gopls (and thus all IDEs), and in general results in a better formatted code. This commit - formats all code with gofumpt (gofumpt -w .) - adds gofumpt linter to golangci-lint to ensure future commits Signed-off-by: Kir Kolyshkin <[email protected]>
No issues found. Signed-off-by: Kir Kolyshkin <[email protected]>
1. Fix the following warning:
sequential_handler_test.go:224:18: `readSignals` - `t` is unused (unparam)
func readSignals(t *testing.T, channel <-chan *Signal, count int) error {
^
Instead of removing t, let's use it -- since all the callers of
readSignals call t.Error(), we can inline it.
2. Fix this warning:
sequential_handler_test.go:212:56: `readSignals` - `count` always receives `1000` (unparam)
func readSignals(t *testing.T, channel <-chan *Signal, count int) {
^
by removing the count argument.
Signed-off-by: Kir Kolyshkin <[email protected]>
Fix the following warning:
conn_test.go:341:51: `waitSignal` - `timeout` always receives `time.Second` (`1000000000`) (unparam)
func waitSignal(sigc <-chan *Signal, name string, timeout time.Duration) *Signal {
^
by removing the timeout argument.
Signed-off-by: Kir Kolyshkin <[email protected]>
And fix the last warning from it:
match.go:31:20: `withMatchType` - `typ` always receives `"signal"` (unparam)
func withMatchType(typ string) MatchOption {
^
Signed-off-by: Kir Kolyshkin <[email protected]>
Contributor
Author
|
Note that these linters are somewhat more opinionated than the default one, so if you don't like any of the changes I've made please let me know and I'll revert (and add directives to ignore particular linters for particular places in the code). The above won't work for |
guelfey
approved these changes
Mar 17, 2022
Member
guelfey
left a comment
There was a problem hiding this comment.
Thanks! Only unparam I'd view as possibly "too opinionated", but just for these concrete things in the testing code I'm fine with it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR enables a few more linters, and fixes warnings found by those. See individual commits for details.
The next linter to add would be
errorlint, but the amount of changes requires is a tad too big to include it into this PR.