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

     1  # https://golang.org/issue/39986: files reported as invalid by go/build should
     2  # be listed in InvalidGoFiles.
     3  
     4  go list -e -f '{{.Incomplete}}{{"\n"}}{{.Error}}{{"\n"}}{{.InvalidGoFiles}}{{"\n"}}' .
     5  stdout '^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
    12  stderr '^found packages m \(m\.go\) and main \(main\.go\) in '$PWD'$'
    13  
    14  ! go list .
    15  stderr '^found packages m \(m\.go\) and main \(main\.go\) in '$PWD'$'
    16  
    17  ! go run .
    18  ! stderr 'no packages loaded'
    19  stderr '^found packages m \(m\.go\) and main \(main\.go\) in '$PWD'$'
    20  
    21  ! go run ./...
    22  ! stderr 'no packages loaded'
    23  stderr '^found packages m \(m\.go\) and main \(main\.go\) in '$PWD'$'
    24  
    25  -- go.mod --
    26  module m
    27  
    28  go 1.17
    29  -- m.go --
    30  package m
    31  -- main.go --
    32  package main
    33  

View as plain text