-
-
Notifications
You must be signed in to change notification settings - Fork 668
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
Hard to provider rules_go examples / tests #720
Comments
go_prefix is problematic for a couple of reasons, and we would like to get rid of it rather than fix it. |
Even better, is there an issue I can follow, which once done will enable me to write things in a way that meets my needs? |
I think we've mentioned deprecating I'd like to understand your problem a little better though. Are you providing macros that instantiate Go rules in users' repositories? If so, I see how it can be annoying to require users to define their own Even if |
In some cases yes, in others no. In the cases where I am, it is absolutely my expectation that folks would include the Go rules prior to mine. I'm happy to GVC, it might be easier to explain? My username is my GitHub handle @google.com |
go_prefix is used to generate Go import paths from Bazel labels. Until now, it has been mandatory, since there's an implicit dependency from all go_library, go_binary, and go_test rules on //:go_prefix. With this change, that dependency is not present when the importpath attribute is specified. This means that if all of the Go rules in a repository specify importpath, there's no need to define a go_prefix rule in the repository root. Fixes bazel-contrib#720 Related bazel-contrib#721
go_prefix is used to generate Go import paths from Bazel labels. Until now, it has been mandatory, since there's an implicit dependency from all go_library, go_binary, and go_test rules on //:go_prefix. With this change, that dependency is not present when the importpath attribute is specified. This means that if all of the Go rules in a repository specify importpath, there's no need to define a go_prefix rule in the repository root. Fixes #720 Related #721
Challenge
I provide Bazel rules. I want to add Go examples / tests. I do NOT want to require all users of my rules to import
rules_go
.Today to use
rules_go
, three main elements are required.rules_go
inWORKSPACE
go_prefix
in/BUILD
.go_binary
in.../BUILD
.It is this second requirement that is problematic because it is on the
BUILD
path that Bazel loads for every.bzl
file in the repo.Strawman
I think the simplest solution would be to enable folks in my situation to override the baked-in
//:prefix
target, so that we can move it into.../BUILD
and enable rule consumers to dodge therules_go
requirement.The text was updated successfully, but these errors were encountered: