Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nogo doesn't propagate analyzer runfiles to the final binary #4255

Open
DolceTriade opened this issue Feb 10, 2025 · 0 comments
Open

Nogo doesn't propagate analyzer runfiles to the final binary #4255

DolceTriade opened this issue Feb 10, 2025 · 0 comments

Comments

@DolceTriade
Copy link
Contributor

If an analyzer references any data attributes, those files are not propagated to the final binary when nogo runs.

This is because nogo strips any runfiles and only plumbs the raw binary down: https://github.com/bazel-contrib/rules_go/blob/master/go/private/context.bzl#L662

Runfiles support for nogo is further complicated by the fact that nogo runs as an "action". Bazel does not create the runfiles symlink farm for inputs in actions. In order for bazel to create a runfile symlink farm, a binary must be passed in as a tool. this means we would need to change how we propagate nogo down to the lower layers of the code.

Creating this issue to align on a direction.

The ultimately motivation for this was to expose the go_sdk to some analyzers that require it now after some upstream changes (in this case, our goimports analyzer broke after updating golang.org/x/tools due to it deciding it wanted to call go env at runtime: https://go-review.googlesource.com/c/tools/+/623296/7/internal/imports/fix.go#572).

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

No branches or pull requests

1 participant