Skip to content

Commit 1e60668

Browse files
committed
gopls/internal/regtest/workspace: unskip duplicate modules test
Unskip and update TestBrokenWorkspace_DuplicateModules. Using go1.20+, the go command does surface errors about duplicate modules in go.work files. Fixes golang/go#57650 Change-Id: If7674525bb57bd84885682f42fc93406f8be85d2 Reviewed-on: https://go-review.googlesource.com/c/tools/+/496886 Run-TryBot: Robert Findley <[email protected]> Reviewed-by: Alan Donovan <[email protected]> TryBot-Result: Gopher Robot <[email protected]> gopls-CI: kokoro <[email protected]>
1 parent 5ce721d commit 1e60668

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

gopls/internal/regtest/workspace/broken_test.go

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,9 @@ import (
2323

2424
// Test for golang/go#53933
2525
func TestBrokenWorkspace_DuplicateModules(t *testing.T) {
26-
testenv.NeedsGo1Point(t, 18)
27-
28-
// TODO(golang/go#57650): fix this feature.
29-
t.Skip("we no longer detect duplicate modules")
26+
// The go command error message was improved in Go 1.20 to mention multiple
27+
// modules.
28+
testenv.NeedsGo1Point(t, 20)
3029

3130
// This proxy module content is replaced by the workspace, but is still
3231
// required for module resolution to function in the Go command.
@@ -98,8 +97,8 @@ const CompleteMe = 222
9897
ProxyFiles(proxy),
9998
).Run(t, src, func(t *testing.T, env *Env) {
10099
env.OpenFile("package1/main.go")
101-
env.Await(
102-
OutstandingWork(lsp.WorkspaceLoadFailure, `found module "example.com/foo" multiple times in the workspace`),
100+
env.AfterChange(
101+
OutstandingWork(lsp.WorkspaceLoadFailure, `module example.com/foo appears multiple times in workspace`),
103102
)
104103

105104
// Remove the redundant vendored copy of example.com.
@@ -110,10 +109,10 @@ const CompleteMe = 222
110109
./package2/vendor/example.com/foo
111110
)
112111
`)
113-
env.Await(NoOutstandingWork())
112+
env.AfterChange(NoOutstandingWork())
114113

115114
// Check that definitions in package1 go to the copy vendored in package2.
116-
location := env.GoToDefinition(env.RegexpSearch("package1/main.go", "CompleteMe")).URI.SpanURI().Filename()
115+
location := string(env.GoToDefinition(env.RegexpSearch("package1/main.go", "CompleteMe")).URI)
117116
const wantLocation = "package2/vendor/example.com/foo/foo.go"
118117
if !strings.HasSuffix(location, wantLocation) {
119118
t.Errorf("got definition of CompleteMe at %q, want %q", location, wantLocation)

0 commit comments

Comments
 (0)