bazelbuild / bazelbuild/bazel

Slow start fetching module extension

Open
#27,944 5 comments 0 reactions 0 assignees View on GitHub
awaiting-user-response team-ExternalDeps type: bug under investigation
Dominant language
Java
Stars
25.8k
Forks
4.6k
Avg merge
2d 20h
Merged PRs (30d)
72

Description

Hi folks,

I've got a bazel repo, that uses a handful of extensions, including `go_sdk`.
The `go.MODULE.bazel` file (included from main `MODULE.bazel`) looks like this:

However, almost every time I try building something, It starts with an excruciatingly slow step:
```
$ bazel build //cli/XXXX
Loading: 0 packages loaded
currently laoding: cli/XXXX
Fetching module extension @@rules_go+//go:extensions.bzl%go_sdk; starting
```
This takes about 3 minutes (i've got very slow corporate proxies).

**I wonder what is wrong with my setup?
What's the reason for this not being cached?**

I'm using bazel version 8.2.1.

The relevant part (I think) from MODULES.bazel is the included `go.MODULES.bazel`:
```
### Go ########################################################################
bazel_dep(
name = "rules_go",
version = "0.59.0",
)

go_sdk = use_extension("@rules_go//go:extensions.bzl", "go_sdk")
go_sdk.download(
sdks = {
"linux_amd64": ("go1.25.4.linux-amd64.tar.gz", "9fa5ffeda4170de60f67f3aa0f824e426421ba724c21e133c1e35d6159ca1bec"),
"linux_arm64": ("go1.25.4.linux-arm64.tar.gz", "a68e86d4b72c2c2fecf7dfed667680b6c2a071221bbdb6913cf83ce3f80d9ff0"),
"darwin_amd64": ("go1.25.4.darwin-amd64.tar.gz", "33ba03ff9973f5bd26d516eea35328832a9525ecc4d169b15937ffe2ce66a7d8"),
"darwin_arm64": ("go1.25.4.darwin-arm64.tar.gz", "c1b04e74251fe1dfbc5382e73d0c6d96f49642d8aebb7ee10a7ecd4cae36ebd2"),
},
version = "1.25.4",
)

# Third-party external dependencies
go_deps = use_extension(
"@gazelle//:extensions.bzl",
"go_deps",
)
go_deps.from_file(go_mod = "//:go.mod")

use_repo(
go_deps,
"com_github_azure_azure_sdk_for_go_sdk_azcore",
(…)
"org_golang_google_protobuf",
)
```

Contributor guide

Open the contributing guide

Research direction

Start with the MODULE.bazel and included go.MODULE.bazel snippets, then inspect the @rules_go//go:extensions.bzl go_sdk extension under Bazel 8.2.1. Reproduce the fetch during bazel build //cli/XXXX and determine why the module extension is reevaluated despite the downloaded SDK; done means explaining or fixing the repeated three-minute fetch.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.