[bazel] Added buildifier to lint Starlark
Tested="bazel run //:buildifier -- -r"
to have buildifier run linting checks on the whole directory
Buildifier excludes the directories named "//**/vendor/*"
This also has all the fixes buildifier applies to the directory so that
it can be run at root without changing unmodified files anymore.
Signed-off-by: Drew Macrae <drewmacrae@google.com>
diff --git a/WORKSPACE b/WORKSPACE
index 66cf1ed..d54449a 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -49,3 +49,46 @@
strip_prefix = "abseil-cpp-master",
urls = ["https://github.com/abseil/abseil-cpp/archive/master.zip"],
)
+
+# Buildifier is a linting tool for our WORKSPACE and BUILD files
+http_archive(
+ name = "io_bazel_rules_go",
+ sha256 = "d1ffd055969c8f8d431e2d439813e42326961d0942bdf734d2c95dc30c369566",
+ urls = [
+ "https://github.com/bazelbuild/rules_go/releases/download/v0.24.5/rules_go-v0.24.5.tar.gz",
+ ],
+)
+
+load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
+
+go_rules_dependencies()
+
+go_register_toolchains()
+
+http_archive(
+ name = "bazel_gazelle",
+ sha256 = "b85f48fa105c4403326e9525ad2b2cc437babaa6e15a3fc0b1dbab0ab064bc7c",
+ urls = [
+ "https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.22.2/bazel-gazelle-v0.22.2.tar.gz",
+ ],
+)
+
+load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies")
+
+gazelle_dependencies()
+
+http_archive(
+ name = "com_google_protobuf",
+ strip_prefix = "protobuf-master",
+ urls = ["https://github.com/protocolbuffers/protobuf/archive/master.zip"],
+)
+
+load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
+
+protobuf_deps()
+
+http_archive(
+ name = "com_github_bazelbuild_buildtools",
+ strip_prefix = "buildtools-main",
+ url = "https://github.com/bazelbuild/buildtools/archive/main.zip",
+)