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

Differentiate compile actions under go_test #3935

Closed
sluongng opened this issue May 7, 2024 · 0 comments · Fixed by #3936
Closed

Differentiate compile actions under go_test #3935

sluongng opened this issue May 7, 2024 · 0 comments · Fixed by #3936

Comments

@sluongng
Copy link
Contributor

sluongng commented May 7, 2024

In Bazel, we use BEP https://bazel.build/remote/bep to emit the telemetry data of a build.

However, BEP and related tool logs files usually assume that we can identify a unique action from a combination of its target path, such as //some/package:target_name, and it's action mnemonic, such as GoCompilePkg.

And this is usually the case. For example, if I have a go_binary target setup, it will create 2 actions underneath: GoCompilePkg to compile the source to archive data and GoLink to link up the archive data into the executable binary. All is good.

However, this is not the case with go_test. For each go foo package, we could write an inner test file under package foo, which has access to unexported funcs and variables, that use the same package name foo. Or, we could write an outer test file under package foo_test, which has access only to the exported funcs and variables of foo.

Because of this, go_test needs to perform 2 compilation actions: one for the inner package and one for the outer package, before linking the results into the test executable binary. This results in 2 unique GoCompilePkg actions under the same //some/package/foo:foo_test target, which are hard to tell apart from looking at the BEP data and/or related tool logs attached to the BEP.


I think we should consider using a different mnemonic for these 2 actions. Perhaps GoTestCompileInnerPkg and GoTestCompileOuterPkg so that we could identify them using external tooling more easily.

sluongng added a commit to sluongng/rules_go that referenced this issue May 7, 2024
sluongng added a commit to sluongng/rules_go that referenced this issue May 7, 2024
sluongng added a commit to sluongng/rules_go that referenced this issue May 7, 2024
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 a pull request may close this issue.

1 participant