...

Text file src/cmd/go/testdata/script/list_issue_59905.txt

Documentation: cmd/go/testdata/script

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

View as plain text