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/build_tests/BUILD b/build_tests/BUILD
index 6563297..5d9c3bf 100644
--- a/build_tests/BUILD
+++ b/build_tests/BUILD
@@ -1,6 +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")
+load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
cc_test(
name = "gflags_build_test",
@@ -100,6 +100,15 @@
go_binary(
name = "hello_go",
- srcs = ["hello.go"],
+ embed = [":build_tests_lib"],
target_compatible_with = ["@platforms//cpu:x86_64"],
+ visibility = ["//visibility:public"],
+)
+
+go_library(
+ name = "build_tests_lib",
+ srcs = ["hello.go"],
+ importpath = "github.com/frc971/971-Robot-Code/build_tests",
+ target_compatible_with = ["@platforms//cpu:x86_64"],
+ visibility = ["//visibility:private"],
)