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/WORKSPACE b/WORKSPACE
index 61991e9..a464a6d 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -126,6 +126,7 @@
# Find a good way to select between these two M4F toolchains.
#"//tools/cpp:cc-toolchain-cortex-m4f-k22",
"//tools/python:python_toolchain",
+ "//tools/go:noop_go_toolchain",
)
http_archive(
@@ -873,3 +874,18 @@
name = "snappy",
path = "third_party/snappy",
)
+
+http_archive(
+ name = "io_bazel_rules_go",
+ sha256 = "2b1641428dff9018f9e85c0384f03ec6c10660d935b750e3fa1492a281a53b0f",
+ urls = [
+ "https://www.frc971.org/Build-Dependencies/rules_go-v0.29.0.zip",
+ "https://github.com/bazelbuild/rules_go/releases/download/v0.29.0/rules_go-v0.29.0.zip",
+ ],
+)
+
+load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
+
+go_rules_dependencies()
+
+go_register_toolchains(version = "1.17.1")