bazel-contrib / bazel-contrib/rules_go

[FR] use local symlink of execroot in gopackagesdriver

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

Description

### What version of rules_go are you using?

v0.29.0

### What version of gazelle are you using?

v0.24.0

### What version of Bazel are you using?

4.2.1

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

N/A

### What operating system and processor architecture are you using?

MacOS

### Requested feature

👋🏼 we've been using gopackagesdriver for our VS Code setup and we're really happy with it. One thing we do wish was customizable though, was to specify whether the GoFiles paths it generates point to `/private/tmp/...` or `/`. The reason for this is that when doing something as simple as "Go to definition" for auto-generated sources, we get taken to the "real" execroot. This _should_ be fine, but in practice VS Code thinks we're opening a new Git repo (because bazel copies over the .git directory) and it makes Git integrations fairly unhappy (see screenshot).

Looking over the gopackagesdriver codebase, this seems like it _should_ be a fairly straightforward feature to enable with a new environment variable (maybe `BAZEL_EXECROOT` to provide the path to the symlink or `BAZEL_USE_EXECROOT_SYMLINK` to try be more clever and figure it out ourselves).

It this something y'all would be open to supporting?

![image](https://user-images.githubusercontent.com/3116474/155706910-59201813-ef90-4451-8f50-68802857c386.png)

Contributor guide

Open the contributing guide

Research direction

Read the gopackagesdriver codebase, focusing on where GoFiles paths are generated and where environment variables are handled. Confirm how the current /private/tmp paths relate to the workspace execroot symlink, then define completion as a supported configuration that makes generated paths use the requested local symlink and preserves Go to definition behavior in VS Code.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, vscode
Domain
build-system, developer-experience
Issue type
Feature
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.