bazel-contrib / bazel-contrib/rules_go

bzlmod: Stable go_sdk path available to IDEs e.g. VScode

Open
#3,877 0 comments 10 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
1.5k
Forks
760
Avg merge
1d 11h
Merged PRs (30d)
12

Description

Users of IDEs such as VSCode may want to use a `rules_go` sdk for tooling, so that the tools use the same go as the code. This path should be stable across versions of `rules_go`. In bzlmod `rules_go`, this regressed.

### What version of rules_go are you using?
0.46.0

### What version of gazelle are you using?
0.35.0

### What version of Bazel are you using?
7.0.2

### Does this issue reproduce with the latest releases of all the above?
Yes

### What operating system and processor architecture are you using?
macOS / arm

### Any other potentially useful information about your toolchain?
Using bzlmod, VSCode

### What did you do?
Update to bzlmod rules go while using vscode

### What did you expect to see?
No IDE errors relating to ${workspaceFolder}/bazel-${workspaceFolderBasename}/external/go_sdk

### What did you see instead?
${workspaceFolder}/bazel-${workspaceFolderBasename}/external/go_sdk is missing.
It can be replaced as a workaround by a long path that includes some cruft and the rules_go version, i.e. ${workspaceFolder}/bazel-${workspaceFolderBasename}/external/rules_go~0.46.0~go_sdk~main___download_0

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the bzlmod setup described with rules_go 0.46.0, Bazel 7.0.2, and VSCode, then inspect how the external go_sdk path is exposed. Compare the missing stable external/go_sdk path with the versioned workaround; done means the stable path exists across rules_go versions and the IDE reports no related errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
build-system, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.