Bump rules_go & Bazel deps (#1973)
**What type of PR is this?**
Deps
**What package or component does this PR mostly affect?**
all
**What does this PR do? Why is it needed?**
Bumping the compatibility SDK is needed due to changes to
`golang.org/x/tools` that require Go 1.19 (`types.Func.Origin()`) and,
temporarily, due to non-hermeticity in rules_go's
`GoToolchainBinaryBuild`.
**Which issues(s) does this PR fix?**
Fixes #
**Other notes for review**
diff --git a/WORKSPACE b/WORKSPACE
index c9a7c69..067b4e3 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -15,10 +15,10 @@
http_archive(
name = "io_bazel_rules_go",
- sha256 = "80a98277ad1311dacd837f9b16db62887702e9f1d1c4c9f796d0121a46c8e184",
+ sha256 = "f4a9314518ca6acfa16cc4ab43b0b8ce1e4ea64b81c38d8a3772883f153346b8",
urls = [
- "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.46.0/rules_go-v0.46.0.zip",
- "https://github.com/bazelbuild/rules_go/releases/download/v0.46.0/rules_go-v0.46.0.zip",
+ "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.50.1/rules_go-v0.50.1.zip",
+ "https://github.com/bazelbuild/rules_go/releases/download/v0.50.1/rules_go-v0.50.1.zip",
],
)
@@ -34,24 +34,57 @@
bazel_features_deps()
-load("@io_bazel_rules_go//go:deps.bzl", "go_download_sdk", "go_register_toolchains", "go_rules_dependencies")
+load("@io_bazel_rules_go//go:deps.bzl", "go_download_sdk", "go_register_nogo", "go_register_toolchains", "go_rules_dependencies")
go_rules_dependencies()
-go_register_toolchains(
+go_register_toolchains(version = "1.23.3")
+
+go_register_nogo(
+ excludes = [
+ # //cmd/gazelle:gazelle_lib has incomplete deps on purpose, which
+ # trips up nogo.
+ "@//cmd/gazelle:__pkg__",
+ ],
nogo = "@bazel_gazelle//:nogo",
- version = "1.22.5",
)
+# Go 1.22 is needed since the non-hermeticity of GoToolchainBinaryBuild results in it downloading
+# Go 1.23 on Windows to build the builder, which then messes up Go version build tag filtering.
+# Go 1.21 is needed to support the toolchain directive in go.mod, which is non-hermetically read
+# by GoToolchainBinaryBuild on Windows.
+# Go 1.20 is needed so support nogo's use of token.File.FileStart.
+# Go 1.19 is needed for recent versions of golang.org/x/tools.
+# TODO: Fix rules_go and set this back to 1.19.
go_download_sdk(
name = "go_compat_sdk",
- version = "1.18.10",
+ version = "1.22.9",
)
load("//:deps.bzl", "gazelle_dependencies")
gazelle_dependencies(go_sdk = "go_sdk")
+# Needed by rules_go when using proto rules, but not provided by its deps macro.
+http_archive(
+ name = "rules_proto",
+ sha256 = "6fb6767d1bef535310547e03247f7518b03487740c11b6c6adb7952033fe1295",
+ strip_prefix = "rules_proto-6.0.2",
+ url = "https://github.com/bazelbuild/rules_proto/releases/download/6.0.2/rules_proto-6.0.2.tar.gz",
+)
+
+load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies")
+
+rules_proto_dependencies()
+
+load("@rules_proto//proto:setup.bzl", "rules_proto_setup")
+
+rules_proto_setup()
+
+load("@rules_proto//proto:toolchains.bzl", "rules_proto_toolchains")
+
+rules_proto_toolchains()
+
# For API doc generation
# This is a dev dependency, users should not need to install it
# so we declare it in the WORKSPACE