build/toolbase/gotoolchain: init

Another piece of the toolbase puzzle, this one is a library which
provides information about the Go SDK picked by Bazel/rules_go, and
allows to build tools that call the `go` tool.

This is effectively the logic from //build/fietsje:def.bzl, but
rewritten to be reusable. In a later CL, we will make Fietsje use this
logic instead of its existing starlark/shell magic.

Change-Id: I2be723089410c81843b54df77bcd665a4e050cbb
Reviewed-on: https://review.monogon.dev/c/monogon/+/329
Reviewed-by: Mateusz Zalega <mateusz@monogon.tech>
diff --git a/build/toolbase/gotoolchain/BUILD.bazel b/build/toolbase/gotoolchain/BUILD.bazel
new file mode 100644
index 0000000..9579e2c
--- /dev/null
+++ b/build/toolbase/gotoolchain/BUILD.bazel
@@ -0,0 +1,25 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
+load(":def.bzl", "toolchain_library")
+
+toolchain_library(
+    name = "toolchain_library",
+    importpath = "source.monogon.dev/build/toolbase/gotoolchain",
+    visibility = ["//visibility:public"],
+    deps = [
+        "@io_bazel_rules_go//go/tools/bazel:go_default_library",
+    ],
+)
+
+# keep
+go_library(
+    name = "go_default_library",
+    embed = [":toolchain_library"],
+    importpath = "source.monogon.dev/build/toolbase/gotoolchain",
+    visibility = ["//visibility:public"],
+)
+
+go_test(
+    name = "go_default_test",
+    srcs = ["toolchain_test.go"],
+    embed = [":go_default_library"],  # keep
+)