treewide: enable pure Go by default
Pure can be safely enabled by default. For those targets which need cgo,
we can set `pure = "off"` on the go_binary or go_test.
This simplifies transitions, and makes the files/files_cc distinction
obsolete.
Change-Id: Ic1a985e7d347a7222f55735c1ee2016e8a7e1c65
Reviewed-on: https://review.monogon.dev/c/monogon/+/4158
Tested-by: Jenkins CI
Reviewed-by: Tim Windelschmidt <tim@monogon.tech>
diff --git a/.bazelrc b/.bazelrc
index ed4fe2e..bcee473 100644
--- a/.bazelrc
+++ b/.bazelrc
@@ -26,6 +26,7 @@
# Run race config with race detector
build:race --@io_bazel_rules_go//go/config:race
+build:race --no@io_bazel_rules_go//go/config:pure
# Only download the final result, the intermediate files can stay on the
# server side.
@@ -35,6 +36,10 @@
# Set the execution platform which adds constraints for the scheduler.
build:remote --extra_execution_platforms=//build/platforms:remote_amd64
+# Enable pure by default. Specific go_binary targets which need cgo should set
+# `pure = "off"`.
+build --@io_bazel_rules_go//go/config:pure
+
# Force netgo and osusergo
build --@io_bazel_rules_go//go/config:tags=osusergo,netgo