[build] Work around test_spec() missing testonly in go_test()
test_spec() should set testonly=true automatically, but that is
blocked on cleaning up the Rust templates. For now, fix the
problem for go_test() uses of test_spec() by setting it directly.
Bug: BLD-493 #comment Work around test_spec() missing testonly in go_test()
Change-Id: Ibaa385be3ddeb01540f7ef7426187e6836cec6f2
diff --git a/build/go/go_test.gni b/build/go/go_test.gni
index 01eb6c7..08034a7 100644
--- a/build/go/go_test.gni
+++ b/build/go/go_test.gni
@@ -31,11 +31,14 @@
_output_path = "${root_out_dir}/${_output_name}"
_is_disabled = defined(invoker.disabled) && invoker.disabled
+
# We only include test metadata for non-disabled, linux/mac tests; metadata
# for fuchsia tests is aggregated in the package template.
_include_test_metadata = !_is_disabled && (is_linux || is_mac)
if (_include_test_metadata) {
test_spec(_test_spec_target_name) {
+ # TODO(BLD-493): testonly should be automatic here
+ testonly = true
name = _main_target_name
location = _output_path
deps = []