github.com/hikaru7719/go@v0.0.0-20181025140707-c8b2ac68906a/src/cmd/go/testdata/script/list_bad_import.txt (about)

     1  # This test matches mod_list_bad_import, but in GOPATH mode.
     2  # Please keep them in sync.
     3  
     4  env GO111MODULE=off
     5  cd example.com
     6  
     7  # Without -e, listing an otherwise-valid package with an unsatisfied direct import should fail.
     8  # BUG: Today it succeeds.
     9  go list -f '{{if .Error}}error{{end}} {{if .Incomplete}}incomplete{{end}} {{range .DepsErrors}}bad dep: {{.Err}}{{end}}' example.com/direct
    10  ! stdout ^error
    11  stdout 'incomplete'
    12  stdout 'bad dep: .*example.com[/\\]notfound'
    13  
    14  # Listing with -deps should also fail.
    15  # BUG: Today, it does not.
    16  # ! go list -deps example.com/direct
    17  # stderr example.com[/\\]notfound
    18  go list -deps example.com/direct
    19  stdout example.com/notfound
    20  
    21  
    22  # Listing an otherwise-valid package that imports some *other* package with an
    23  # unsatisfied import should also fail.
    24  # BUG: Today, it succeeds.
    25  go list -f '{{if .Error}}error{{end}} {{if .Incomplete}}incomplete{{end}} {{range .DepsErrors}}bad dep: {{.Err}}{{end}}' example.com/indirect
    26  ! stdout ^error
    27  stdout incomplete
    28  stdout 'bad dep: .*example.com[/\\]notfound'
    29  
    30  # Again, -deps should fail.
    31  # BUG: Again, it does not.
    32  # ! go list -deps example.com/indirect
    33  # stderr example.com[/\\]notfound
    34  go list -deps example.com/indirect
    35  stdout example.com/notfound
    36  
    37  
    38  # Listing the missing dependency directly should fail outright...
    39  ! go list -f '{{if .Error}}error{{end}} {{if .Incomplete}}incomplete{{end}}' example.com/notfound
    40  stderr 'no Go files in .*example.com[/\\]notfound'
    41  ! stdout error
    42  ! stdout incomplete
    43  
    44  # ...but listing with -e should succeed.
    45  go list -e -f '{{if .Error}}error{{end}} {{if .Incomplete}}incomplete{{end}}' example.com/notfound
    46  stdout error
    47  stdout incomplete
    48  
    49  
    50  # The pattern "all" should match only packages that actually exist,
    51  # ignoring those whose existence is merely implied by imports.
    52  go list -e -f '{{.ImportPath}}' all
    53  stdout example.com/direct
    54  stdout example.com/indirect
    55  ! stdout example.com/notfound
    56  
    57  
    58  -- example.com/direct/direct.go --
    59  package direct
    60  import _ "example.com/notfound"
    61  
    62  -- example.com/indirect/indirect.go --
    63  package indirect
    64  import _ "example.com/direct"
    65  
    66  -- example.com/notfound/README --
    67  This directory intentionally left blank.