bazel-contrib / bazel-contrib/rules_go
no go_sdk from a go_sdk.from_file set up
- Dominant language
- Go
- Stars
- 1.5k
- Forks
- 760
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 12
Description
This is on bazel 8.4.2 and rules_go 0.58.3.
I've previously had a `go_sdk.download` call and a `use_repo(go_sdk, "go_sdk")` in my MODULE.bazel to provide a target for aspect_rules_lint's format_multirun to have a `gofmt` (that is, `go = "@go_sdk//:bin/gofmt",`). This has worked fine.
But when I change the `go_sdk.download` to a `go_sdk.from_file(go_mod = "//:go.mod)"`, the line `use_repo(go_sdk, "go_sdk")` errors with:
```
ERROR: module extension @@rules_go+//go:extensions.bzl%go_sdk does not generate repository "go_sdk", yet it is imported as "go_sdk" in the usage at /Users/jmhodges/founding/src/founding/MODULE.bazel:34:23
```
I suspect this wasn't intentioned. Perhaps, I'm not getting a `gofmt` in the correct way, of course. But the error is from way before the call to format_multirun.
(I could also be convinced that `go_sdk.from_file` isn't as useful as `go_deps.from_file`)
Contributor guide
Research direction
Start with the go_sdk usage in MODULE.bazel, comparing the working go_sdk.download setup with go_sdk.from_file(go_mod = "//:go.mod"). Trace the go_sdk extension and use_repo interaction that produces the reported error. Done means establishing the intended repository behavior for from_file and resolving or documenting the mismatch without breaking the existing download setup.
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
- Mostly clear
- Newbie friendliness
- 35/100