Skip to content

rtk go / Go filters can hide real compiler errors and report misleading success #2281

Open

Description

@capton586

Summary

rtk can swallow or misclassify real Go compile/vet errors. In our project this caused rtk go ... output to report
misleading summaries such as:

  • No tests found
  • No issues found
  • 2 errors

These summaries did not reflect the actual Go compiler/vet failure. The only reliable way we found to see the real
error was to bypass filtering with rtk proxy.

Version

rtk --version
# rtk 0.42.0

Reproduction / Diagnosis

Running normal filtered Go commands through rtk hides the actionable compiler errors.

The real errors are visible with:

rtk proxy go vet ./internal/workorder/biz/ 2>&1 | grep -iE "undefined|cannot|cycle"

Without rtk proxy, the filtered output can incorrectly summarize the run as successful or unrelated.

One confusing example: go-m1cpu may print 2 errors, but those are clang/CGO warnings and the build exits with 0;
meanwhile the actual Go errors such as undefined, cannot, or import cycle can be filtered away.

Expected Behavior

rtk go / Go-related filters should preserve real Go compile/vet errors, especially diagnostics containing patterns
like:

  • undefined
  • cannot
  • import cycle
  • package/type/function resolution failures

If filtering is uncertain, it should prefer showing the raw Go diagnostic rather than summarizing as No issues
found / No tests found.

Actual Behavior

The filtered output can hide the real compiler/vet diagnostics and emit misleading summaries, causing agents/users to
debug the wrong issue.

Impact

This is high impact for AI-agent workflows because the agent trusts the filtered terminal output. When compiler
errors are hidden, the agent may conclude the build/test/vet pass is clean or chase unrelated CGO warnings.

Workaround

Use raw proxy mode:

rtk proxy go vet ./internal/workorder/biz/ 2>&1 | grep -iE "undefined|cannot|cycle"

But this defeats the purpose of using rtk go for safe summarized Go diagnostics.

Activity

  1. pszymkowiak commented on Jun 5, 2026

    @pszymkowiak
    Collaborator

    wshm · Automated triage by AI

    🔍 Automated Triage

    🐛 Category bug
    🟠 Priority high
    🎯 Confidence 91%

    Summary

    Go filter layer swallows real compiler/vet errors and emits misleading success summaries; related to #2203 but broader in scope — covers go vet, go test, and CGO warning misclassification across multiple commands.


    Triaged automatically by wshm · This is an automated analysis, not a human review.

  2. HetCreep commented on Aug 4, 2026

    @HetCreep

    Adding evidence for this from an external source audit of v0.44.2 (tag v0.44.2, commit 700bdde).

    Provenance up front: this is an AI-assisted source audit, human-directed. Everything below is read from the source and from git log/git blame — I did not run go vet against a broken module, so treat the runtime claim as source-derived, not observed.

    The interesting part is that this exact bug was already fixed once, in the same file, for go build — and go vet was left behind.

    The fix that landed

    f69ad6e (2026-06-01), "fix(go): respect build failure exit status", changed the build path to:

    • route through runner::run_filtered_with_exit(..., filter_go_build_with_exit, ...) so the filter can see the exit code at all, and
    • add a non_file_error_prefixes table (~15 entries) for the errors that carry no .go: location, including:
      • go: go.mod file not found
      • go: inconsistent vendoring
      • cannot find package
      • build constraints exclude all Go files

    The path that did not get it

    go vet (src/cmds/go/go_cmd.rs:117, with the filter at :703 and :715) still:

    • calls plain runner::run_filtered(...) — the exit code never reaches the filter, and
    • collects only lines where trimmed.contains(".go:"), returning the clean summary otherwise.

    So for any failure whose message has no .go: in it — which is precisely the list f69ad6e enumerated for build — rtk go vet prints:

    Go vet: No issues found
    

    on a module that did not vet. The failure classes are the same ones; only the two call sites differ.

    Suggested direction (untested — no programmer has reviewed this)

    The narrowest change that matches what already shipped for build: switch the vet path to run_filtered_with_exit, and either share non_file_error_prefixes between the two filters or apply the same "non-zero exit ⇒ never emit a clean summary" rule. Sharing the table seems preferable to duplicating it, since the divergence is what produced this.

    Related

    This is one instance of the pattern described in #2317 ("Tool filters mask hard failures with benign summaries"), whose affected-filter list is marked "(likely)" — go was not on it. #2735 looks like the same shape for golangci-lint exiting 0 when lint fails.

    Happy to supply the full audit note for this one, or to be told it is already covered by work in flight.

  3. alponme commented on Oct 28, 2026

    @alponme

    A small deterministic repro of the go vet part of this issue, observed (not only source-derived) on rtk 1.1.0 (full edition, x86_64-unknown-linux-musl; identical on 1.0.1), Ubuntu 24.04.5, go1.27.3 linux/amd64:

    $ mkdir -p /tmp/repro && cd /tmp/repro
    $ printf 'package main\n\nfunc main() {}\n' > main.go     # no go.mod
    $ go vet ./... ; echo rc=$?
    pattern ./...: directory prefix . does not contain main module or its selected dependencies
    rc=1
    $ rtk go vet ./... ; echo rc=$?
    Go vet: No issues found
    rc=1
    $ go vet . ; echo rc=$?
    go: go.mod file not found in current directory or any parent directory; see 'go help modules'
    rc=1
    $ rtk go vet . ; echo rc=$?
    Go vet: No issues found
    rc=1

    The hook rewrites go vet ./... to rtk go vet ./.... The exit code survives, but the output says the opposite of what happened and the only diagnostic (on stderr) is gone. filter_go_vet in src/cmds/go/go_cmd.rs keeps only lines containing .go: and otherwise returns "Go vet: No issues found", without looking at the exit status. This is the same pattern that #2188 fixed for go build. #2311, which targeted go vet, was closed without merging. Open PRs #2284 and #3577 would cover it.

    — Alfredo Pons Menargues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:clibugpriority:high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions