...

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

Documentation: cmd/go/testdata/script

     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
     5go list -e -deps ./scan
     6stdout m/want
     7
     8go list -e -deps ./multi
     9stdout m/want
    10
    11go list -e -deps ./constraint
    12stdout 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
    24go list -e -f '{{range .GoFiles}}{{.}},{{end}}' ./scan
    25stdout '^good.go,scan.go,$'
    26
    27go list -e -f '{{range .GoFiles}}{{.}},{{end}}' ./multi
    28stdout '^a.go,b.go,$'
    29
    30go list -e -f '{{range .GoFiles}}{{.}},{{end}}' ./constraint
    31stdout '^good.go,$'
    32go list -e -f '{{range .IgnoredGoFiles}}{{.}},{{end}}' ./constraint
    33stdout '^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 --
    42module m
    43
    44go 1.14
    45
    46-- want/want.go --
    47package want
    48
    49-- scan/scan.go --
    50// scan error
    51ʕ◔ϖ◔ʔ
    52
    53-- scan/good.go --
    54package scan
    55
    56import _ "m/want"
    57
    58-- multi/a.go --
    59package a
    60
    61-- multi/b.go --
    62package b
    63
    64import _ "m/want"
    65
    66-- constraint/constraint.go --
    67// +build !!nope
    68
    69package constraint
    70
    71-- constraint/good.go --
    72package constraint
    73
    74import _ "m/want"
    75
    76-- cgotest/cgo_test.go --
    77package cgo_test
    78
    79// cgo is not allowed in tests.
    80// See golang.org/issue/18647
    81
    82import "C"
    83import (
    84	"testing"
    85	_ "m/want"
    86)
    87
    88func Test(t *testing.T) {}
    89
    90-- cgoflag/cgoflag.go --
    91package cgoflag
    92
    93// #cgo ʕ◔ϖ◔ʔ:
    94
    95import _ "m/want"

View as plain text