Skip to content

chore(lint): fix revive unhandled-error findings in pluginsgen - #9353

Open
DoDiODev wants to merge 1 commit into
apache:mainfrom
DoDiODev:pr/pluginsgen-lint
Open

DoDiODev wants to merge 1 commit into
apache:mainfrom
DoDiODev:pr/pluginsgen-lint

Conversation

@DoDiODev

@DoDiODev DoDiODev commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

⚠️ Pre Checklist

Please complete ALL items in this checklist, and remove before submitting

  • I have read through the Contributing Documentation.
  • I have added relevant tests. (N/A — lint only, no behavior change)
  • I have added relevant documentation. (N/A)
  • I will add labels to the PR, such as pr-type/bug-fix, pr-type/feature-development, etc.
    (I can't set labels myself; suggested: pr-type/refactor, component/framework)

Summary

make lint fails locally on macOS with four revive findings in
tools/pluginsgen/main.go (added in #9288):

tools/pluginsgen/main.go:81:3: unhandled-error: Unhandled error in call to function fmt.Fprintf (revive)
tools/pluginsgen/main.go:245:2: unhandled-error: Unhandled error in call to function bytes.Buffer.WriteString (revive)
... (16 WriteString calls in total)

CI does not report them. With the same golangci-lint v2.15.0 and the same
config, revive's unhandled-error does not fire on Linux at all (checked with
the official golangci/golangci-lint:v2.15.0 image and a minimal file). This
matches golangci/golangci-lint#5580: some typed revive rules silently stop
working in golangci-lint depending on the Go toolchain setup.

Fix:

  • .golangci.yaml: add bytes.Buffer.WriteString to the unhandled-error
    ignore list. It is documented to always return a nil error; fmt.Printf,
    fmt.Println and fmt.Fprintln are already listed.
  • pluginsgen: print the error with fmt.Fprintln(os.Stderr, "pluginsgen:", err)
    (same output, already on the ignore list).

Does this close any open issues?

N/A

Screenshots

N/A

Other Information

  • cd backend && make mock && golangci-lint run on macOS (golangci-lint
    v2.15.0, go1.27.3): 4 issues before, 0 issues. after.
  • go build ./tools/pluginsgen: OK.

Local golangci-lint runs (e.g. on macOS) report unhandled-error for
tools/pluginsgen. CI does not, because revive's typed rules can silently
stop working in golangci-lint depending on the Go toolchain setup
(golangci/golangci-lint#5580).

- Ignore bytes.Buffer.WriteString: it always returns a nil error.
- Use fmt.Fprintln for the error message, which is already ignored.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant