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

     1  # go list -e -deps should list imports from any file it can read, even if
     2  # other files in the same package cause go/build.Import to return an error.
     3  # Verifies golang.org/issue/38568
     4  
     5  go list -e -deps ./scan
     6  stdout m/want
     7  
     8  go list -e -deps ./multi
     9  stdout m/want
    10  
    11  go list -e -deps ./constraint
    12  stdout m/want
    13  
    14  [cgo] go list -e -test -deps ./cgotest
    15  [cgo] stdout m/want
    16  
    17  [cgo] go list -e -deps ./cgoflag
    18  [cgo] stdout m/want
    19  
    20  
    21  # go list -e should include files with errors in GoFiles, TestGoFiles, and
    22  # other lists, assuming they match constraints.
    23  # Verifies golang.org/issue/39986
    24  go list -e -f '{{range .GoFiles}}{{.}},{{end}}' ./scan
    25  stdout '^good.go,scan.go,$'
    26  
    27  go list -e -f '{{range .GoFiles}}{{.}},{{end}}' ./multi
    28  stdout '^a.go,b.go,$'
    29  
    30  go list -e -f '{{range .GoFiles}}{{.}},{{end}}' ./constraint
    31  stdout '^good.go,$'
    32  go list -e -f '{{range .IgnoredGoFiles}}{{.}},{{end}}' ./constraint
    33  stdout '^constraint.go,$'
    34  
    35  [cgo] go list -e -f '{{range .XTestGoFiles}}{{.}},{{end}}' ./cgotest
    36  [cgo] stdout '^cgo_test.go,$'
    37  
    38  [cgo] go list -e -f '{{range .GoFiles}}{{.}},{{end}}' ./cgoflag
    39  [cgo] stdout '^cgoflag.go,$'
    40  
    41  -- go.mod --
    42  module m
    43  
    44  go 1.14
    45  
    46  -- want/want.go --
    47  package want
    48  
    49  -- scan/scan.go --
    50  // scan error
    51  ʕ◔ϖ◔ʔ
    52  
    53  -- scan/good.go --
    54  package scan
    55  
    56  import _ "m/want"
    57  
    58  -- multi/a.go --
    59  package a
    60  
    61  -- multi/b.go --
    62  package b
    63  
    64  import _ "m/want"
    65  
    66  -- constraint/constraint.go --
    67  // +build !!nope
    68  
    69  package constraint
    70  
    71  -- constraint/good.go --
    72  package constraint
    73  
    74  import _ "m/want"
    75  
    76  -- cgotest/cgo_test.go --
    77  package cgo_test
    78  
    79  // cgo is not allowed in tests.
    80  // See golang.org/issue/18647
    81  
    82  import "C"
    83  import (
    84  	"testing"
    85  	_ "m/want"
    86  )
    87  
    88  func Test(t *testing.T) {}
    89  
    90  -- cgoflag/cgoflag.go --
    91  package cgoflag
    92  
    93  // #cgo ʕ◔ϖ◔ʔ:
    94  
    95  import _ "m/want"
    96  

View as plain text