bazel-contrib / bazel-contrib/rules_go

differing goroots depending on which MODULE.bazel gosdk call

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

Description

This is one bazel 8.4.2 and rules_go 0.58.3.

It's unclear where to set GOROOT for vscode that will be consistent across different MODULE.bazel set ups. I'm attempting to update the [Editor setup](https://github.com/bazel-contrib/rules_go/wiki/Editor-setup) wiki page and noticed the difference between `from_file` and `download`

If you use

```
module(
name = "foobar",
)

bazel_dep(name = "rules_go", version = "0.58.3")

go_sdk = use_extension("@rules_go//go:extensions.bzl", "go_sdk")
go_sdk.from_file(go_mod = "//:go.mod")
```

you'll get an GOROOT at

`bazel-${BAZEL_MODULE_NAME}/external/rules_go++go_sdk+main___download_0/`

If you use

```
module(
name = "foobar",
)

bazel_dep(name = "rules_go", version = "0.58.3")

go_sdk = use_extension("@rules_go//go:extensions.bzl", "go_sdk")
go_sdk.download(
name = "go_sdk",
version = "1.25.0",
)
```

you'll get a GOROOT at `bazel-${BAZEL_MODULE_NAME}/external/rules_go++go_sdk+go_sdk`

It would be nice to consolidate these into one path.

It's also unclear if that `main` in the first GOROOT path is always the same across repos. The current [Editor setup](https://github.com/bazel-contrib/rules_go/wiki/Editor-setup) wiki page claims it may be, but I'm not sure what config changes it.

Contributor guide

Open the contributing guide

Research direction

Start with the two MODULE.bazel examples in the issue and compare the documented Editor setup wiki guidance for go_sdk.from_file and go_sdk.download. Trace how each setup produces its GOROOT path, then define what consistent path behavior and documentation should look like across repositories.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
build-system
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.