1
0
mirror of https://github.com/golang/go synced 2024-09-29 04:14:27 -06:00

cmd/go/internal/modload: skip deleted entries in UpdateWorkFile

Fixes #50958

Change-Id: I25b4f34bea7705525217296471ce97e6a2ab99f6
Reviewed-on: https://go-review.googlesource.com/c/go/+/382245
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
This commit is contained in:
Bryan C. Mills 2022-02-01 16:35:02 -05:00 committed by Bryan Mills
parent 1c6426505e
commit 54b2a75406
2 changed files with 20 additions and 0 deletions

View File

@ -610,6 +610,9 @@ func UpdateWorkFile(wf *modfile.WorkFile) {
missingModulePaths := map[string]string{} // module directory listed in file -> abspath modroot
for _, d := range wf.Use {
if d.Path == "" {
continue // d is marked for deletion.
}
modRoot := d.Path
if d.ModulePath == "" {
missingModulePaths[d.Path] = modRoot

View File

@ -0,0 +1,17 @@
go work use -r .
cmp go.work go.work.want
-- go.mod --
module example
go 1.18
-- go.work --
go 1.18
use sub
-- go.work.want --
go 1.18
use .
-- sub/README.txt --
This directory no longer contains a go.mod file.