...

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

Documentation: cmd/go/testdata/script

     1# https://golang.org/issue/39986: files reported as invalid by go/build should
     2# be listed in InvalidGoFiles.
     3
     4go list -e -f '{{.Incomplete}}{{"\n"}}{{.Error}}{{"\n"}}{{.InvalidGoFiles}}{{"\n"}}' .
     5stdout '^true\nfound packages m \(m\.go\) and main \(main\.go\) in '$PWD'\n\[main.go\]\n'
     6
     7
     8# https://golang.org/issue/45827: 'go run .' should report the same package
     9# errors as 'go build' and 'go list'.
    10
    11! go build
    12stderr '^found packages m \(m\.go\) and main \(main\.go\) in '$PWD'$'
    13
    14! go list .
    15stderr '^found packages m \(m\.go\) and main \(main\.go\) in '$PWD'$'
    16
    17! go run .
    18! stderr 'no packages loaded'
    19stderr '^found packages m \(m\.go\) and main \(main\.go\) in '$PWD'$'
    20
    21! go run ./...
    22! stderr 'no packages loaded'
    23stderr '^found packages m \(m\.go\) and main \(main\.go\) in '$PWD'$'
    24
    25-- go.mod --
    26module m
    27
    28go 1.17
    29-- m.go --
    30package m
    31-- main.go --
    32package main

View as plain text