diff --git a/gopls/internal/cache/session_test.go b/gopls/internal/cache/session_test.go index a3bd8ce58..913c3bd1f 100644 --- a/gopls/internal/cache/session_test.go +++ b/gopls/internal/cache/session_test.go @@ -20,6 +20,7 @@ import ( func TestZeroConfigAlgorithm(t *testing.T) { testenv.NeedsExec(t) // executes the Go command + t.Setenv("GOPACKAGESDRIVER", "off") type viewSummary struct { // fields exported for cmp.Diff @@ -33,6 +34,12 @@ func TestZeroConfigAlgorithm(t *testing.T) { options func(dir string) map[string]any // options may refer to the temp dir } + includeReplaceInWorkspace := func(string) map[string]any { + return map[string]any{ + "includeReplaceInWorkspace": true, + } + } + type test struct { name string files map[string]string // use a map rather than txtar as file content is tiny @@ -235,7 +242,7 @@ func TestZeroConfigAlgorithm(t *testing.T) { "b/go.mod": "module golang.org/b\ngo 1.18\n", "b/b.go": "package b", }, - []folderSummary{{dir: "."}}, + []folderSummary{{dir: ".", options: includeReplaceInWorkspace}}, []string{"a/a.go", "b/b.go"}, []viewSummary{{GoModView, ".", nil}}, }, @@ -247,7 +254,7 @@ func TestZeroConfigAlgorithm(t *testing.T) { "b/go.mod": "module golang.org/b\ngo 1.18\nrequire golang.org/a v1.2.3\nreplace golang.org/a => ../", "b/b.go": "package b", }, - []folderSummary{{dir: "."}}, + []folderSummary{{dir: ".", options: includeReplaceInWorkspace}}, []string{"a/a.go", "b/b.go"}, []viewSummary{{GoModView, ".", nil}, {GoModView, "b", nil}}, }, @@ -277,12 +284,12 @@ replace ( "d/go.mod": "module golang.org/d\ngo 1.18", "d/d.go": "package d", }, - []folderSummary{{dir: "."}}, + []folderSummary{{dir: ".", options: includeReplaceInWorkspace}}, []string{"b/b.go", "c/c.go", "d/d.go"}, []viewSummary{{GoModView, ".", nil}, {GoModView, "d", nil}}, }, { - "go.mod with many replace", + "go.mod with replace outside the workspace", map[string]string{ "go.mod": "module golang.org/a\ngo 1.18", "a.go": "package a", @@ -290,7 +297,7 @@ replace ( "b/b.go": "package b", }, []folderSummary{{dir: "b"}}, - []string{"a/a.go", "b/b.go"}, + []string{"a.go", "b/b.go"}, []viewSummary{{GoModView, "b", nil}}, }, { diff --git a/gopls/internal/settings/default.go b/gopls/internal/settings/default.go index 752effab3..f29b43942 100644 --- a/gopls/internal/settings/default.go +++ b/gopls/internal/settings/default.go @@ -115,7 +115,7 @@ func DefaultOptions(overrides ...func(*Options)) *Options { ReportAnalysisProgressAfter: 5 * time.Second, TelemetryPrompt: false, LinkifyShowMessage: false, - IncludeReplaceInWorkspace: true, + IncludeReplaceInWorkspace: false, ZeroConfig: true, }, Hooks: Hooks{