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