summaryrefslogtreecommitdiffhomepage
path: root/tools/nogo/defs.bzl
diff options
context:
space:
mode:
authorAdin Scannell <ascannell@google.com>2021-02-02 09:34:29 -0800
committergVisor bot <gvisor-bot@google.com>2021-02-02 09:37:09 -0800
commit3817c7349de2dde950fd65dcab1f4859c095eeaf (patch)
treed50e24f2443a517c425e28e188e5dc797e778f39 /tools/nogo/defs.bzl
parent00d21b9ae0e379caba54720c71f200596100c8f0 (diff)
Remove go_tool_library references.
This is required only for the built-in bazel nogo functionality. Since we roll these targets manually via the wrappers, we don't need to use go_tool_library. The inconsistent use of these targets leads to conflicting instantiations of go_default_library and go_tool_library, which both contain the same output files. PiperOrigin-RevId: 355184975
Diffstat (limited to 'tools/nogo/defs.bzl')
-rw-r--r--tools/nogo/defs.bzl8
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/nogo/defs.bzl b/tools/nogo/defs.bzl
index 161ea972e..0c48a7a5a 100644
--- a/tools/nogo/defs.bzl
+++ b/tools/nogo/defs.bzl
@@ -188,6 +188,14 @@ def _nogo_aspect_impl(target, ctx):
# All work is done in the shadow properties for go rules. For a proto
# library, we simply skip the analysis portion but still need to return a
# valid NogoInfo to reference the generated binary.
+ #
+ # Note that we almost exclusively use go_library, not go_tool_library.
+ # This is because nogo is manually annotated, so the go_tool_library kind
+ # is not needed to avoid dependency loops. Unfortunately, bazel coverdata
+ # is exported *only* as a go_tool_library. This does not cause a problem,
+ # since there is guaranteed to be no conflict. However for consistency,
+ # we should not introduce new go_tool_library dependencies unless strictly
+ # necessary.
if ctx.rule.kind in ("go_library", "go_tool_library", "go_binary", "go_test"):
srcs = ctx.rule.files.srcs
deps = ctx.rule.attr.deps