src: lint: bump golangci-lint to 1.59, address unchecked fmt.Fprint* #12065
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.
Another attempt at bumping the linter.
In 1.59, they removed a blanket
Ignore: "fmt:.*",
and instead now rely on a more targeted ignore set of rules based on the types thatfmt.Fprint*()
prints into. The main reason this bites us hard here is because when we print fromurfave/cli
Command
runners, we use the built-in contextAppWriter
andErrWriter
.AppWriter
is usuallyos.Stdout
which is not excluded in the new rules,ErrWriter
is usuallyos.Stderr
but it could also be something else and the new rules can't differentiate and neither can we.I'm fine with the more targeted ruleset. It means having to opt-in to ignores if you have good reason to. Mostly I've gone with
_, _ =
ignores, but there's a few places of blocks offmt.Fprintf
lines where I've gone with//nolint:errcheck
.In terms of landing this, it will have conflicts with the markets removal PRs, notably there's a big change set in paych.go which is disappearing with those PRs. This PR isn't urgent and it may be easier to rebase this on those changes once they land than the other way around.