Skip to content

lint: enable more golangci-lint plugins#144

Open
Arnaud M. (ameukam) wants to merge 3 commits into
agent-substrate:mainfrom
ameukam:add-more-golangci-lint-linters
Open

lint: enable more golangci-lint plugins#144
Arnaud M. (ameukam) wants to merge 3 commits into
agent-substrate:mainfrom
ameukam:add-more-golangci-lint-linters

Conversation

@ameukam

@ameukam Arnaud M. (ameukam) commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Enable contextcheck, gocritic, and exhaustive to catch detached contexts, bug patterns, and incomplete controller state-machine switches.

Assisted by GPT 5.5

It's a good idea to open an issue first for discussion.

  • Tests pass
  • Appropriate changes to documentation are included in the PR

@ameukam

Copy link
Copy Markdown
Contributor Author

@troychiu Troy Chiu (troychiu) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also enable formatters which group imports by prefix, such as goimports?

@thockin

Copy link
Copy Markdown
Collaborator

This looks overall good, but:
a) needs a rebase
b) can I arm-twist you into enabling one per commit so we can see which fixes go to which lints?

@BenTheElder

Copy link
Copy Markdown
Collaborator

Let's hold on the formatters part.

Reconciliation and RPC calls should inherit the caller's context instead
of spinning up a detached context.Background().

Demo binaries are excluded from the linter.

Signed-off-by: Arnaud Meukam <ameukam@gmail.com>
Opt in to gocritic's high-signal bug-pattern checks only (disable-all plus
an explicit enabled-checks allowlist).

Signed-off-by: Arnaud Meukam <ameukam@gmail.com>
Enum switches now cover every case so a new value trips the linter instead
of slipping past a default. Map checking stays opt-in
(explicit-exhaustive-map); our only enum-keyed maps are partial
corev1.ResourceList literals.

Signed-off-by: Arnaud Meukam <ameukam@gmail.com>
@ameukam Arnaud M. (ameukam) force-pushed the add-more-golangci-lint-linters branch from 86264f9 to 19b684c Compare June 27, 2026 19:31
@ameukam

Copy link
Copy Markdown
Contributor Author

This looks overall good, but: a) needs a rebase b) can I arm-twist you into enabling one per commit so we can see which fixes go to which lints?

Tim Hockin (@thockin) it's done

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.

4 participants