Import rules_go
The motivation here is to use Go for the scouting web server. It
sounds like we have enough knowledge in the team to at least give it a
try.
$ bazel run //build_tests:hello_go
WARNING: Option 'ui' is deprecated
INFO: Invocation ID: d227f296-c249-44d3-88c0-42c2aee1bde2
INFO: SHA256 (https://golang.org/dl/?mode=json&include=all) = dd71d0c702dbeb9a765da037c9792250fb9e440fa3bd5dbdca91db34f0265446
INFO: Analyzed target //build_tests:hello_go (45 packages loaded, 47836 targets configured).
INFO: Found 1 target...
INFO: Writing explanation of rebuilds to '/tmp/bazel_explain.log'
Target //build_tests:hello_go up-to-date:
bazel-bin/build_tests/hello_go_/hello_go
INFO: Elapsed time: 99.935s, Critical Path: 1.57s
INFO: 8 processes: 4 internal, 4 linux-sandbox.
INFO: Build completed successfully, 8 total actions
INFO: Build completed successfully, 8 total actions
hello world
In order to work around a bazel issue, I created a dummy NOOP Go
toolchain. That toolchain will be used on all platforms where we don't
explicitly support Go. The key is to also mark all `go_*` target as
only being compatible with x86 Linux.
Change-Id: I0a9be3748c59998f5d2dea8d6a162779a0f31af1
Signed-off-by: Philipp Schrader <philipp.schrader@gmail.com>
diff --git a/build_tests/BUILD b/build_tests/BUILD
index d142c13..6563297 100644
--- a/build_tests/BUILD
+++ b/build_tests/BUILD
@@ -1,5 +1,6 @@
load("@com_google_protobuf//:protobuf.bzl", "cc_proto_library")
load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_py_library")
+load("@io_bazel_rules_go//go:def.bzl", "go_binary")
cc_test(
name = "gflags_build_test",
@@ -96,3 +97,9 @@
target_compatible_with = ["@platforms//os:linux"],
deps = ["@python_jinja2"],
)
+
+go_binary(
+ name = "hello_go",
+ srcs = ["hello.go"],
+ target_compatible_with = ["@platforms//cpu:x86_64"],
+)