treewide: add race-detector config

This also disables all `pure = "on"` attributes as they propagate too
far and break the race detector because rules_go contradicts itself by
forcing pure go even when CGO is required by the race detector. We build
everything for our node images static and pure via a transition anyway,
so this is actually fine.

Change-Id: I5cd3879fba4258caa94df4dbea5c6472867b7e34
Reviewed-on: https://review.monogon.dev/c/monogon/+/3725
Tested-by: Jenkins CI
Reviewed-by: Hendrik Hofstadt <hendrik@monogon.tech>
diff --git a/osbase/build/def.bzl b/osbase/build/def.bzl
index b2dfe91..24f2af7 100644
--- a/osbase/build/def.bzl
+++ b/osbase/build/def.bzl
@@ -19,12 +19,13 @@
     """
     Transition that enables pure, static build of Go binaries.
     """
-    race = settings['@io_bazel_rules_go//go/config:race']
+    race = settings["@io_bazel_rules_go//go/config:race"]
     pure = not race
 
     return {
         "@io_bazel_rules_go//go/config:pure": pure,
         "@io_bazel_rules_go//go/config:static": True,
+        "//command_line_option:platforms": "//build/platforms:linux_amd64_static",
     }
 
 build_pure_transition = transition(
@@ -35,6 +36,7 @@
     outputs = [
         "@io_bazel_rules_go//go/config:pure",
         "@io_bazel_rules_go//go/config:static",
+        "//command_line_option:platforms",
     ],
 )
 
diff --git a/osbase/erofs/BUILD.bazel b/osbase/erofs/BUILD.bazel
index 596b428..d48eb1f 100644
--- a/osbase/erofs/BUILD.bazel
+++ b/osbase/erofs/BUILD.bazel
@@ -23,7 +23,6 @@
         "erofs_test.go",
     ],
     embed = [":erofs"],
-    pure = "on",  # keep
     deps = [
         "@com_github_stretchr_testify//assert",
         "@com_github_stretchr_testify//require",
diff --git a/osbase/fsquota/BUILD.bazel b/osbase/fsquota/BUILD.bazel
index 350f33d..7c62fd7 100644
--- a/osbase/fsquota/BUILD.bazel
+++ b/osbase/fsquota/BUILD.bazel
@@ -17,7 +17,6 @@
     name = "fsquota_test",
     srcs = ["fsquota_test.go"],
     embed = [":fsquota"],
-    pure = "on",
     deps = [
         "@com_github_stretchr_testify//require",
         "@org_golang_x_sys//unix",
diff --git a/osbase/test/ktest/BUILD.bazel b/osbase/test/ktest/BUILD.bazel
index 733d695..0a43ab4 100644
--- a/osbase/test/ktest/BUILD.bazel
+++ b/osbase/test/ktest/BUILD.bazel
@@ -13,7 +13,6 @@
 go_binary(
     name = "ktest",
     embed = [":ktest_lib"],
-    pure = "on",
     visibility = [
         "//go/net/psample:__pkg__",
         "//metropolis:__subpackages__",
diff --git a/osbase/test/ktest/init/BUILD.bazel b/osbase/test/ktest/init/BUILD.bazel
index 56b262c..ec34d49 100644
--- a/osbase/test/ktest/init/BUILD.bazel
+++ b/osbase/test/ktest/init/BUILD.bazel
@@ -11,7 +11,6 @@
 go_binary(
     name = "init",
     embed = [":init_lib"],
-    pure = "on",
     visibility = [
         "//visibility:public",
     ],