diff --git a/deps.bzl b/deps.bzl index 84d48aba0..5e9da6eb3 100644 --- a/deps.bzl +++ b/deps.bzl @@ -54,6 +54,16 @@ def gazelle_dependencies( sha256 = "74d544d96f4a5bb630d465ca8bbcfe231e3594e5aae57e1edbf17a6eb3ca2506", ) + _maybe( + http_archive, + name = "rules_license", + urls = [ + "https://mirror.bazel.build/github.com/bazelbuild/rules_license/releases/download/0.0.8/rules_license-0.0.8.tar.gz", + "https://github.com/bazelbuild/rules_license/releases/download/0.0.8/rules_license-0.0.8.tar.gz", + ], + sha256 = "241b06f3097fd186ff468832150d6cc142247dc42a32aaefb56d0099895fd229", + ) + if go_sdk: go_repository_cache( name = "bazel_gazelle_go_repository_cache", diff --git a/internal/go_repository.bzl b/internal/go_repository.bzl index ed1853636..01b66d573 100644 --- a/internal/go_repository.bzl +++ b/internal/go_repository.bzl @@ -385,8 +385,10 @@ repo(default_package_metadata = ["//:gazelle_generated_package_info"]) def _generate_package_info(*, importpath, version): package_name = importpath - package_url = "https://" + importpath - package_version = version.removeprefix("v") + + # TODO: Consider adding support for custom remotes. + package_url = "https://" + importpath if version else None + package_version = version.removeprefix("v") if version else None return """ load("@rules_license//rules:package_info.bzl", "package_info")