Skip to content

fix(go): report failure when build produces unrecognized error output#3023

Open
Abhi-DevHub wants to merge 1 commit into
rtk-ai:developfrom
Abhi-DevHub:fix/go-build-false-success
Open

fix(go): report failure when build produces unrecognized error output#3023
Abhi-DevHub wants to merge 1 commit into
rtk-ai:developfrom
Abhi-DevHub:fix/go-build-false-success

Conversation

@Abhi-DevHub

Copy link
Copy Markdown

Summary

\ ilter_go_build_with_exit()\ now reports failure with raw output preserved when \go build\ produces unrecognized non-empty output that doesn't match any known error or progress pattern. Previously, unrecognized lines fell through silently and the filter reported success despite the presence of non-download, non-progress output text.

Problem

\ ilter_go_build()\ determined success purely by scanning for known error patterns. When \go build\ failed with an error that didn't match any pattern (e.g. \stat ...: directory not found\ for an invalid package path), the filter swallowed the error and reported success.

A successful \go build\ produces no output (or only \go: downloading ...\ progress lines). Any other unrecognized output indicates an error the filter doesn't understand — it should be passed through, not hidden.

Changes

  • \src/cmds/go/go_cmd.rs: Added \has_unrecognized_output()\ helper that detects non-empty, non-download, non-progress, non-header output lines that don't match known error patterns. When \errors.is_empty()\ but unrecognized output exists, \ ormat_go_build_failure()\ is called regardless of exit code.
  • Added tests for unrecognized error output and download-only success

Test plan

  • \cargo clippy --all-targets\ — no warnings
  • New test \ est_filter_go_build_unrecognized_error_not_swallowed\ confirms raw error is preserved
  • New test \ est_filter_go_build_download_lines_still_success\ confirms download-only output still reports success
  • Existing test \ est_filter_go_build_nonzero_exit_never_reports_success\ continues to pass

Fixes #1599

filter_go_build_with_exit() determined success purely by scanning for
known error patterns. When go build failed with an error that didn't
match any pattern (e.g. 'stat ...: directory not found'), unrecognized
output lines fell through silently and the filter returned 'Success'
despite the presence of non-download, non-progress output text.

A successful go build produces no output or only download/progress lines.
Any other unrecognized output is now treated as a failure - the raw
output is preserved through format_go_build_failure so the actual error
remains visible.

Fixes rtk-ai#1599

Signed-off-by: Abhi-DevHub <abhishekkumar@duck.com>
@CLAassistant

CLAassistant commented Jul 16, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

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.

go build: reports "Success" when build fails with unrecognized error

2 participants