From ea73ae871c911e3a6dff7b00563bd71b3f62fdd2 Mon Sep 17 00:00:00 2001 From: Fabian Meumertzheim Date: Tue, 7 Jan 2025 08:56:10 +0100 Subject: [PATCH] Use apparent repo name in `go mod tidy` suggestion This will print `@io_bazel_rules_go//go:go` if the user uses the legacy repo name. Before Bazel 8.1.0, it will emit `...//go:go` instead of `...//go`, but correctness is more important than brevity in this case. --- internal/go_repository.bzl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/go_repository.bzl b/internal/go_repository.bzl index 48a9d1490..28da2331d 100644 --- a/internal/go_repository.bzl +++ b/internal/go_repository.bzl @@ -192,7 +192,7 @@ def _go_repository_impl(ctx): fail("cannot specify both version and %s" % key) if not ctx.attr.sum: if is_module_extension_repo: - fail("No sum for {}@{} found, run bazel run @rules_go//go -- mod tidy to generate it".format(ctx.attr.importpath, ctx.attr.version)) + fail("No sum for {}@{} found, update go.sum with:\n bazel run".format(ctx.attr.importpath, ctx.attr.version), Label("@io_bazel_rules_go//go"), "-- mod tidy") else: fail("if version is specified, sum must also be")