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

Don't use "-linkobj" when compile for a binary or test #4098

Open
sluongng opened this issue Sep 11, 2024 · 0 comments
Open

Don't use "-linkobj" when compile for a binary or test #4098

sluongng opened this issue Sep 11, 2024 · 0 comments

Comments

@sluongng
Copy link
Contributor

Currently in compilepkg.go, when we invoke go tool compile, we are unconditionally adding -linkobj to create 2 separate artifacts: .x for downstream library compilation and .a for downstream binary linking.

This is efficient for go_library, but for the compilation which happens under go_test and go_binary, the output artifact(s) will not be used for any other downstream actions except GoLink for that test/binary to create the final Go executable.

So for the GoCompilePkg action under go_test and go_binary, it will be better if we remove -linkobj and only generate the .a file. In other words, we should only be using -linkobj when the downstream consumer of the artifact is unclear, such as for the GoCompilePkg action under go_library or go_proto_library.

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