Skip to content

fix(lint): make non-Linux stubs pass staticcheck SA4023 on macOS - #2129

Merged
rdimitrov merged 1 commit into
mainfrom
rdimitrov/malleable-slayer-b810e78f
Oct 6, 2026
Merged

rdimitrov merged 1 commit into
mainfrom
rdimitrov/malleable-slayer-b810e78f

Conversation

@rdimitrov

Copy link
Copy Markdown
Member

Summary

  • task lint failed on macOS with staticcheck SA4023 ("this comparison is always true"). The //go:build !linux stubs returned an inline errors.New(...) on every path. On darwin, staticcheck therefore proved the error was never nil and flagged the shared callers' err != nil checks.
  • The stubs now return a package-level sentinel error, which the analyzer cannot fold. Error messages and behavior are unchanged.
  • This fixes the case reported in the issue (internal/executionexecutor) and a second case the issue missed (environment/microvm/cmd/mecatl-guest-agent). The second case was hidden because task lint stops at the first failing module.

Issue relationship

Closes #2101

Type of change

  • Bug fix
  • New feature
  • Refactoring (no behavior change)
  • Dependency update
  • Documentation
  • Other (describe):

Test plan

Baseline checks

  • Linting (task lint): 0 issues in all modules on macOS (arm64), and also with GOOS=linux task lint
  • Fast offline test suite (task test): not run; the only edits are in !linux stub files that Linux CI does not compile
  • Pre-review race suite (task test:race): not run, same reason
  • Offline demo (go run ./cmd/mecademo): not affected
  • Markdown changed: docs generation/link checks (task docs)
  • User docs/user-facing behavior changed: site build (task site:build)
  • Guarded engine API affected: compatibility check (task api:check)
  • Intentional engine API change: task api:update + engine/CHANGELOG.md

Also verified: GOOS=linux go build succeeds for mecatl-executor and mecatl-guest-agent.

Changes

File Change
internal/executionexecutor/command_unsupported.go Stubs return the shared errCommandUnsupported sentinel
environment/microvm/cmd/mecatl-guest-agent/mounts_other.go Stubs return the shared errRequiresLinux sentinel

User-facing change

None. Contributors on macOS can now pass task lint.

Special notes for reviewers

  • CI lints only on Linux, so it never compiles !linux files. A GOOS=darwin lint step on the existing runner would catch this class of failure; that is left for a follow-up.
  • On macOS, go test ./internal/executionexecutor/ fails before and after this change. The tests in that package exercise Linux-only behavior. This is unrelated to the lint fix.

🤖 Generated with Claude Code

The !linux stubs in internal/executionexecutor and the microVM guest
agent returned an inline errors.New on every path, so staticcheck on
darwin proved the error always non-nil and flagged the shared callers'
err != nil checks as always true. Return a package-level sentinel
instead; the analyzer cannot fold a mutable package variable. Linux
builds do not compile these files.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@rdimitrov
rdimitrov merged commit e0685aa into main Oct 6, 2026
37 checks passed
@rdimitrov
rdimitrov deleted the rdimitrov/malleable-slayer-b810e78f branch October 6, 2026 07:33
@toolhive-release-app toolhive-release-app Bot mentioned this pull request Oct 7, 2026
2 tasks
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.

task lint fails on macOS: staticcheck SA4023 in execution executor non-Linux stub

2 participants