golang/go

x/tools/gopls: when editing Go files in GOMODCACHE, offer to clone module and add replace directive

Open

#77.212 geöffnet am 16. Jan. 2026

Auf GitHub ansehen
 (8 Kommentare) (2 Reaktionen) (0 zugewiesene Personen)Go (19.008 Forks)batch import
FeatureRequestToolsgoplshelp wanted

Repository-Metriken

Stars
 (133.883 Stars)
PR-Merge-Metriken
 (Keine gemergten PRs in 30 T)

Beschreibung

Being able to quickly edit the standard library (e.g. by inserting a print statement) is extremely useful during debugging. However, editing source files from dependencies within the module cache is not as convenient. Gopls could detect an attempt to modify such a file and offer to clone the module, add a replace directive to the main module, and move the cursor to the corresponding position in the cloned file, which can then be freely edited. The replace directive could be flagged with a // FIXME: debugging comment, with a code action to revert it.

(Credit to @prattmic for the idea.)

Contributor Guide