Remove some fields from Go context (#4034)
**What type of PR is this?**
Starlark cleanup
**What does this PR do? Why is it needed?**
All of these are either unused or can easily be retrieved from another
context field.
We were already retrieving them from both so this change makes things
more consistent.
**Which issues(s) does this PR fix?**
Fixes #
**Other notes for review**
diff --git a/go/private/rules/binary.bzl b/go/private/rules/binary.bzl
index 5267c86..833a1c4 100644
--- a/go/private/rules/binary.bzl
+++ b/go/private/rules/binary.bzl
@@ -96,7 +96,7 @@
def _go_binary_impl(ctx):
"""go_binary_impl emits actions for compiling and linking a go executable."""
- go = go_context(ctx)
+ go = go_context(ctx, include_deprecated_properties = False)
is_main = go.mode.link not in (LINKMODE_SHARED, LINKMODE_PLUGIN)
library = go.new_library(go, importable = False, is_main = is_main)
diff --git a/go/private/rules/library.bzl b/go/private/rules/library.bzl
index 933d5f7..d0fc88b 100644
--- a/go/private/rules/library.bzl
+++ b/go/private/rules/library.bzl
@@ -34,7 +34,7 @@
def _go_library_impl(ctx):
"""Implements the go_library() rule."""
- go = go_context(ctx)
+ go = go_context(ctx, include_deprecated_properties = False)
library = go.new_library(go)
source = go.library_to_source(go, ctx.attr, library, ctx.coverage_instrumented())
archive = go.archive(go, source)
diff --git a/go/private/rules/nogo.bzl b/go/private/rules/nogo.bzl
index 7aa63cf..18f8e86 100644
--- a/go/private/rules/nogo.bzl
+++ b/go/private/rules/nogo.bzl
@@ -38,7 +38,7 @@
return None
# Generate the source for the nogo binary.
- go = go_context(ctx)
+ go = go_context(ctx, include_deprecated_properties = False)
nogo_main = go.declare_file(go, path = "nogo_main.go")
nogo_args = ctx.actions.args()
nogo_args.add("gennogomain")
diff --git a/go/private/rules/source.bzl b/go/private/rules/source.bzl
index 48c5233..0344501 100644
--- a/go/private/rules/source.bzl
+++ b/go/private/rules/source.bzl
@@ -27,7 +27,7 @@
def _go_source_impl(ctx):
"""Implements the go_source() rule."""
- go = go_context(ctx)
+ go = go_context(ctx, include_deprecated_properties = False)
library = go.new_library(go)
source = go.library_to_source(go, ctx.attr, library, ctx.coverage_instrumented())
return [
diff --git a/go/private/rules/stdlib.bzl b/go/private/rules/stdlib.bzl
index cb82f36..1a3e4c2 100644
--- a/go/private/rules/stdlib.bzl
+++ b/go/private/rules/stdlib.bzl
@@ -30,7 +30,7 @@
)
def _stdlib_impl(ctx):
- go = go_context(ctx)
+ go = go_context(ctx, include_deprecated_properties = False)
return go.toolchain.actions.stdlib(go)
stdlib = rule(
diff --git a/go/private/rules/test.bzl b/go/private/rules/test.bzl
index c6cba05..c1cfe2e 100644
--- a/go/private/rules/test.bzl
+++ b/go/private/rules/test.bzl
@@ -56,7 +56,7 @@
It emits an action to run the test generator, and then compiles the
test into a binary."""
- go = go_context(ctx)
+ go = go_context(ctx, include_deprecated_properties = False)
# Compile the library to test with internal white box tests
internal_library = go.new_library(go, testfilter = "exclude")
@@ -100,7 +100,7 @@
arguments.add("-cover_mode", "atomic")
else:
arguments.add("-cover_mode", "set")
- arguments.add("-cover_format", go.cover_format)
+ arguments.add("-cover_format", go.mode.cover_format)
arguments.add(
# the l is the alias for the package under test, the l_test must be the
# same with the test suffix