From 87a94b6a4aaa14cebe9d20ea31896d936194adc3 Mon Sep 17 00:00:00 2001 From: Fabian Meumertzheim Date: Sun, 2 Jul 2023 16:45:47 +0200 Subject: [PATCH] Fix `go_sdk` extension failure for unnamed root module (#3612) Fixes failures such as the following of the root module never calls `module`: ``` go_download_sdk_rule( Error in repository_rule: invalid user-provided repo name '__download_0': valid names may contain only A-Z, a-z, 0-9, '-', '_', '.', and must start with a letter ``` --- go/private/extensions.bzl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/go/private/extensions.bzl b/go/private/extensions.bzl index 03d3fea261..ad4013b5c0 100644 --- a/go/private/extensions.bzl +++ b/go/private/extensions.bzl @@ -154,7 +154,8 @@ def _default_go_sdk_name(*, module, multi_version, tag_type, index): # Keep the version out of the repository name if possible to prevent unnecessary rebuilds when # it changes. return "{name}_{version}_{tag_type}_{index}".format( - name = module.name, + # "main_" is not a valid module name and thus can't collide. + name = module.name or "main_", version = module.version if multi_version else "", tag_type = tag_type, index = index,