version: implement Go tooling
These two packages implement respectively:
1. A companion Go library to access data from //version/spec
Protobuf data.
2. A Go code generator and related Bazel build infrastructure to convert
Bazel build status data into an embedded //version/spec Protobuf
Version message.
The two allow for stamping Go artifacts with a generated spec.Version
proto, and allows Go code to work with said messages.
The two systems are split to allow decoupling stamping build artifacts
from processing such version messages. This is so that eg. a Metropolis
client tool can receive a server's Version field, and then show that
field to the user.
Change-Id: I82fbfa6bc2418edc979cdc6e1fdee60ee75a88b7
Reviewed-on: https://review.monogon.dev/c/monogon/+/2332
Reviewed-by: Lorenz Brun <lorenz@monogon.tech>
Tested-by: Jenkins CI
diff --git a/version/stampgo/BUILD.bazel b/version/stampgo/BUILD.bazel
new file mode 100644
index 0000000..cbcca39
--- /dev/null
+++ b/version/stampgo/BUILD.bazel
@@ -0,0 +1,19 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
+
+go_library(
+ name = "stampgo_lib",
+ srcs = ["main.go"],
+ importpath = "source.monogon.dev/version/stampgo",
+ visibility = ["//visibility:private"],
+ deps = [
+ "//version/spec",
+ "@com_github_coreos_go_semver//semver",
+ "@org_golang_google_protobuf//proto",
+ ],
+)
+
+go_binary(
+ name = "stampgo",
+ embed = [":stampgo_lib"],
+ visibility = ["//visibility:public"],
+)