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

go: go_tool_library support for the //go:embed directive #2860

Closed
farazdagi opened this issue Apr 14, 2021 · 3 comments
Closed

go: go_tool_library support for the //go:embed directive #2860

farazdagi opened this issue Apr 14, 2021 · 3 comments

Comments

@farazdagi
Copy link

What version of rules_go are you using?

v0.26.0

What version of gazelle are you using?

v0.23.0

What version of Bazel are you using?

3.7.0

Does this issue reproduce with the latest releases of all the above?

Yes

What operating system and processor architecture are you using?

OSX

What did you do?

I've been writing static code analyzer, so had to rely on go_tool_library (to avoid circular deps, which would occur if I've used go_library). Within that code analyzer, I wanted to use //go:embed directive, but it turns out that in #2806 support for that directive was added for go_library, go_binary, and go_test only.

What did you expect to see?

I expected that embedsrcs attribute is available for go_tool_library the same way it is available for go_library.

What did you see instead?

Instead I've seen that support for //go:embed was limited to go_library, go_binary, and go_test.

NB: I suppose go_embed_data might be used here, but since go 1.16 exposes native way of embedding, and rules_go do already implement new directive in go_library, it is probably worth implementing it in go_tool_library.

@farazdagi
Copy link
Author

It doesn't seem that I can use go_embed_data target within go_tool_library, whenever I do so, I get circular dependency error:
image

@jayconrod
Copy link
Contributor

This seems reasonable. go_tool_library and go_library have nearly the same implementation, so this might just be a matter of adding the embedsrcs attribute to the rule declaration.

Be advised though that go_tool_library should be deprecated in favor of go_library as soon as we stop needing go_tool_library for nogo, probably when Bazel 4.2 or 5.0 is the minimum supported version.

@robfig
Copy link
Contributor

robfig commented Dec 1, 2021

go_tool_library no longer exists as of v0.29! Now that you can use go_library, this issue seems to be solved.

@robfig robfig closed this as completed Dec 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants