Skip to content

fix(go): avoid false build errors from download logs#992

Merged
aeppling merged 3 commits intortk-ai:developfrom
em0t:fix/go-build-false-errors
Apr 3, 2026
Merged

fix(go): avoid false build errors from download logs#992
aeppling merged 3 commits intortk-ai:developfrom
em0t:fix/go-build-false-errors

Conversation

@em0t
Copy link
Copy Markdown
Contributor

@em0t em0t commented Apr 3, 2026

Summary

  • tighten rtk go build error detection so dependency download/progress lines are not treated as compiler failures
  • keep real compiler errors such as file.go:line:col diagnostics and explicit toolchain error lines
  • add regression coverage for package names containing errors, xerrors, and multierror

Minimal Case

Raw

go: downloading github.com/pkg/errors v0.9.1
go: downloading golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028

Previous RTK

Go build: 2 errors
  go: downloading github.com/pkg/errors v0.9.1
  go: downloading golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028

This PR

Go build: Success

Testing

  • cargo fmt --all
  • cargo clippy --all-targets
  • cargo test --all

Notes

  • cargo clippy --all-targets still reports pre-existing warnings outside this change set

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 3, 2026

CLA assistant check
All committers have signed the CLA.

@em0t em0t force-pushed the fix/go-build-false-errors branch from 44832d8 to f2fe39d Compare April 3, 2026 09:36
@em0t em0t changed the base branch from master to develop April 3, 2026 09:36
@em0t em0t force-pushed the fix/go-build-false-errors branch from f2fe39d to 8848409 Compare April 3, 2026 09:39
Signed-off-by: em0t <10153971+em0t@users.noreply.github.com>
@em0t em0t force-pushed the fix/go-build-false-errors branch from 8848409 to d44fd3e Compare April 3, 2026 10:09
@em0t
Copy link
Copy Markdown
Contributor Author

em0t commented Apr 3, 2026

Could a maintainer please approve and run workflows so CI can start for review?

@aeppling aeppling self-assigned this Apr 3, 2026
@aeppling aeppling added the filter-quality Filter produces incorrect/truncated signal label Apr 3, 2026
@aeppling
Copy link
Copy Markdown
Contributor

aeppling commented Apr 3, 2026

The old broad match caught four patterns:

  • contains("error")
  • contains(".go:")
  • contains("undefined")
  • contains("cannot")

The new is_go_build_error_line() catches:

  • contains(".go:") ✓
  • go: build failed, go: error, error: ✓
  • But drops undefined and cannot as standalone keywords

What this misses: Go compiler errors that surface without a file.go:line:col prefix, e.g.: undefined: missingFunc cannot find package "foo/bar"

This is debatable but i think those are important if go compiler use to tell about missing import or not defined function/etc

Signed-off-by: em0t <10153971+em0t@users.noreply.github.com>
@em0t
Copy link
Copy Markdown
Contributor Author

em0t commented Apr 3, 2026

Thanks @aeppling, good catch. I pushed an update that keeps the download-line false-positive fix but restores non-file build errors, including undefined: ..., cannot find package ..., import cycles, build constraint failures, and go.mod/go.work parse errors. I also added regression tests for these cases.

Signed-off-by: em0t <10153971+em0t@users.noreply.github.com>
@em0t
Copy link
Copy Markdown
Contributor Author

em0t commented Apr 3, 2026

I pushed a small follow-up on top of this: the test fixture now uses only public package paths, and go build now also preserves go.mod file not found ..., no Go files in ..., and broken go.work module-loading errors.

@aeppling aeppling merged commit 9c1cf2f into rtk-ai:develop Apr 3, 2026
9 checks passed
@aeppling
Copy link
Copy Markdown
Contributor

aeppling commented Apr 3, 2026

thanks for all quality filters contributions

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

Labels

filter-quality Filter produces incorrect/truncated signal

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants