Import gazelle
This patch imports gazelle as a linter. It automatically generates
BUILD file entries for Go code and at the same time keeps BUILD files
formatted.
The `tools/lint:run-ci` target is set up to automatically add new Go
repositories as well.
I added a tool at `//tools/go:mirror_go_repos` that needs to be run
before anyone can merge code that uses third-party Go libraries.
Change-Id: I1fbf6761439d45893f5be88d294ccc3c567840ca
Signed-off-by: Philipp Schrader <philipp.schrader@gmail.com>
diff --git a/tools/go/BUILD b/tools/go/BUILD
index ec8aa26..1895ffe 100644
--- a/tools/go/BUILD
+++ b/tools/go/BUILD
@@ -1,5 +1,36 @@
-# This file exists to create a NOOP toolchain for Go on platforms that don't
-# support Go. We can probably get rid of this once
+py_library(
+ name = "mirror_lib",
+ srcs = [
+ "mirror_lib.py",
+ ],
+)
+
+py_binary(
+ name = "tweak_gazelle_go_deps",
+ srcs = [
+ "tweak_gazelle_go_deps.py",
+ ],
+ visibility = ["//visibility:public"],
+ deps = [
+ ":mirror_lib",
+ ],
+)
+
+py_binary(
+ name = "mirror_go_repos",
+ srcs = [
+ "mirror_go_repos.py",
+ ],
+ data = [
+ "@go_sdk//:bin/go",
+ ],
+ deps = [
+ ":mirror_lib",
+ ],
+)
+
+# The remainder of this file exists to create a NOOP toolchain for Go on
+# platforms that don't support Go. We can probably get rid of this once
# https://github.com/bazelbuild/bazel/issues/12897 is fixed.
#
# For platforms that do support Go, we use go_register_toolchain() in