"""
For a library github.com/joe/project/lib, create lib/BUILD, containing a single library with the special name "go_default_library." Using this name tells Bazel to set up the files so it can be imported in .go files as (in this example) github.com/joe/project/lib.
"""
(from https://github.com/bazelbuild/rules_go)
Out of curiosity, when might I *not* want the files to be available for import into .go files? i.e., why are only targets named go_default_library made available for import?
Background:
I'm trying to construct some more complicated BUILD files to exploit some niche behaviors of Go, and the library naming restrictions are starting to bite.*
I've poked around at def.bzl in rules_go a bit. It looks like if one were to remove lines 170-171, I get what I need. However, I can't tell if this case was added for some specific reason that would then become broken.
If this is in support of some other feature, I totally understand. But if this behavior happened by accident or if it's no longer relevant, can we open up the naming for increased flexibility?
I've put together a repo that might make it easy to experiment with some BUILD target name variations. They also demonstrate the sort of thing I'm trying to do.
https://github.com/treaster/bazel_go_target_names
This file demonstrates some go_library() targets that are named in different ways.
https://github.com/treaster/bazel_go_target_names/blob/master/src/example.com/lib_target/BUILD
This file demonstrates some go_binary() targets that depend on those libraries.
https://github.com/treaster/bazel_go_target_names/blob/master/src/example.com/bin_target/BUILD
Thanks!!
-Mike
*Specifically, I want a BUILD file with two separate build targets for the Go package, where one target includes a few extra symbols for test-only purposes. This type of files-included-for-tests-only is supported by `go test`.
--
You received this message because you are subscribed to the Google Groups "bazel-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-discuss/66cbe66a-bf3b-4fec-a6a9-848597d9963f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.