@@ -20,6 +20,7 @@ import (
20
20
21
21
func TestZeroConfigAlgorithm (t * testing.T ) {
22
22
testenv .NeedsExec (t ) // executes the Go command
23
+ t .Setenv ("GOPACKAGESDRIVER" , "off" )
23
24
24
25
type viewSummary struct {
25
26
// fields exported for cmp.Diff
@@ -33,6 +34,12 @@ func TestZeroConfigAlgorithm(t *testing.T) {
33
34
options func (dir string ) map [string ]any // options may refer to the temp dir
34
35
}
35
36
37
+ includeReplaceInWorkspace := func (string ) map [string ]any {
38
+ return map [string ]any {
39
+ "includeReplaceInWorkspace" : true ,
40
+ }
41
+ }
42
+
36
43
type test struct {
37
44
name string
38
45
files map [string ]string // use a map rather than txtar as file content is tiny
@@ -235,7 +242,7 @@ func TestZeroConfigAlgorithm(t *testing.T) {
235
242
"b/go.mod" : "module golang.org/b\n go 1.18\n " ,
236
243
"b/b.go" : "package b" ,
237
244
},
238
- []folderSummary {{dir : "." }},
245
+ []folderSummary {{dir : "." , options : includeReplaceInWorkspace }},
239
246
[]string {"a/a.go" , "b/b.go" },
240
247
[]viewSummary {{GoModView , "." , nil }},
241
248
},
@@ -247,7 +254,7 @@ func TestZeroConfigAlgorithm(t *testing.T) {
247
254
"b/go.mod" : "module golang.org/b\n go 1.18\n require golang.org/a v1.2.3\n replace golang.org/a => ../" ,
248
255
"b/b.go" : "package b" ,
249
256
},
250
- []folderSummary {{dir : "." }},
257
+ []folderSummary {{dir : "." , options : includeReplaceInWorkspace }},
251
258
[]string {"a/a.go" , "b/b.go" },
252
259
[]viewSummary {{GoModView , "." , nil }, {GoModView , "b" , nil }},
253
260
},
@@ -277,20 +284,20 @@ replace (
277
284
"d/go.mod" : "module golang.org/d\n go 1.18" ,
278
285
"d/d.go" : "package d" ,
279
286
},
280
- []folderSummary {{dir : "." }},
287
+ []folderSummary {{dir : "." , options : includeReplaceInWorkspace }},
281
288
[]string {"b/b.go" , "c/c.go" , "d/d.go" },
282
289
[]viewSummary {{GoModView , "." , nil }, {GoModView , "d" , nil }},
283
290
},
284
291
{
285
- "go.mod with many replace" ,
292
+ "go.mod with replace outside the workspace " ,
286
293
map [string ]string {
287
294
"go.mod" : "module golang.org/a\n go 1.18" ,
288
295
"a.go" : "package a" ,
289
296
"b/go.mod" : "module golang.org/b\n go 1.18\n require golang.org/a v1.2.3\n replace golang.org/a => ../" ,
290
297
"b/b.go" : "package b" ,
291
298
},
292
299
[]folderSummary {{dir : "b" }},
293
- []string {"a/a .go" , "b/b.go" },
300
+ []string {"a.go" , "b/b.go" },
294
301
[]viewSummary {{GoModView , "b" , nil }},
295
302
},
296
303
{
0 commit comments