1 # Expect no panic
2 go list -f '{{if .DepsErrors}}{{.DepsErrors}}{{end}}' -export -e -deps
3 cmpenv stdout wanterr_59905
4
5 # Expect no panic (Issue 61816)
6 cp level1b_61816.txt level1b/pkg.go
7 go list -f '{{if .DepsErrors}}{{.DepsErrors}}{{end}}' -export -e -deps
8 cmpenv stdout wanterr_61816
9
10 -- wanterr_59905 --
11 [# test/main/level1a
12 level1a${/}pkg.go:5:2: level2x redeclared in this block
13 level1a${/}pkg.go:4:2: other declaration of level2x
14 level1a${/}pkg.go:5:2: "test/main/level1a/level2y" imported as level2x and not used
15 level1a${/}pkg.go:8:39: undefined: level2y
16 # test/main/level1b
17 level1b${/}pkg.go:5:2: level2x redeclared in this block
18 level1b${/}pkg.go:4:2: other declaration of level2x
19 level1b${/}pkg.go:5:2: "test/main/level1b/level2y" imported as level2x and not used
20 level1b${/}pkg.go:8:39: undefined: level2y
21 ]
22 -- wanterr_61816 --
23 [level1b${/}pkg.go:4:2: package foo is not in std ($GOROOT${/}src${/}foo)]
24 [# test/main/level1a
25 level1a${/}pkg.go:5:2: level2x redeclared in this block
26 level1a${/}pkg.go:4:2: other declaration of level2x
27 level1a${/}pkg.go:5:2: "test/main/level1a/level2y" imported as level2x and not used
28 level1a${/}pkg.go:8:39: undefined: level2y
29 level1b${/}pkg.go:4:2: package foo is not in std ($GOROOT${/}src${/}foo)]
30 -- level1b_61816.txt --
31 package level1b
32
33 import (
34 "foo"
35 )
36
37 func Print() { println(level2x.Value, level2y.Value) }
38
39 -- go.mod --
40 module test/main
41
42 go 1.20
43 -- main.go --
44 package main
45
46 import (
47 "test/main/level1a"
48 "test/main/level1b"
49 )
50
51 func main() {
52 level1a.Print()
53 level1b.Print()
54 }
55 -- level1a/pkg.go --
56 package level1a
57
58 import (
59 "test/main/level1a/level2x"
60 "test/main/level1a/level2y"
61 )
62
63 func Print() { println(level2x.Value, level2y.Value) }
64 -- level1a/level2x/pkg.go --
65 package level2x
66
67 var Value = "1a/2x"
68 -- level1a/level2y/pkg.go --
69 package level2x
70
71 var Value = "1a/2y"
72 -- level1b/pkg.go --
73 package level1b
74
75 import (
76 "test/main/level1b/level2x"
77 "test/main/level1b/level2y"
78 )
79
80 func Print() { println(level2x.Value, level2y.Value) }
81 -- level1b/level2x/pkg.go --
82 package level2x
83
84 var Value = "1b/2x"
85 -- level1b/level2y/pkg.go --
86 package level2x
87
88 var Value = "1b/2y"
View as plain text