github.com/hikaru7719/go@v0.0.0-20181025140707-c8b2ac68906a/src/cmd/go/testdata/script/mod_patterns.txt (about)

     1  env GO111MODULE=on
     2  
     3  cd m
     4  
     5  # 'go list all' should list all of the packages used (directly or indirectly) by
     6  # the packages in the main module, but no other packages from the standard
     7  # library or active modules.
     8  #
     9  # 'go list ...' should list packages in all active modules and the standard library.
    10  # But not cmd/* - see golang.org/issue/26924.
    11  #
    12  # 'go list example.com/m/...' should list packages in all modules that begin with 'example.com/m/'.
    13  #
    14  # 'go list ./...' should list only packages in the current module, not other active modules.
    15  #
    16  # Warnings about unmatched patterns should only be printed once.
    17  #
    18  # And the go command should be able to keep track of all this!
    19  go list -f '{{.ImportPath}}: {{.Match}}' all ... example.com/m/... ./... ./xyz...
    20  stdout 'example.com/m/useunicode: \[all \.\.\. example.com/m/... ./...\]'
    21  stdout 'example.com/m/useunsafe: \[all \.\.\. example.com/m/... ./...\]'
    22  [cgo] stdout 'example.com/m/useC: \[all \.\.\. example.com/m/... ./...\]'
    23  [!cgo] ! stdout example.com/m/useC
    24  stdout 'example.com/unused/useerrors: \[\.\.\.\]' # but not "all"
    25  stdout 'example.com/m/nested/useencoding: \[\.\.\. example.com/m/...\]' # but NOT "all" or "./..."
    26  stdout '^unicode: \[all \.\.\.\]'
    27  stdout '^unsafe: \[all \.\.\.\]'
    28  stdout 'index/suffixarray: \[\.\.\.\]'
    29  ! stdout cmd/pprof # golang.org/issue/26924
    30  
    31  stderr -count=1 '^go: warning: "./xyz..." matched no packages$'
    32  
    33  env CGO_ENABLED=0
    34  go list -f '{{.ImportPath}}: {{.Match}}' all ... example.com/m/... ./... ./xyz...
    35  ! stdout example.com/m/useC
    36  
    37  -- m/go.mod --
    38  module example.com/m
    39  
    40  require example.com/unused v0.0.0 // indirect
    41  replace example.com/unused => ../unused
    42  
    43  require example.com/m/nested v0.0.0 // indirect
    44  replace example.com/m/nested => ../nested
    45  
    46  -- m/useC/useC.go --
    47  package useC
    48  import _ "C" // "C" is a pseudo-package, not an actual one
    49  -- m/useunicode/useunicode.go --
    50  package useunicode
    51  import _ "unicode"
    52  -- m/useunsafe/useunsafe.go --
    53  package useunsafe
    54  import _ "unsafe"
    55  
    56  -- unused/go.mod --
    57  module example.com/unused
    58  -- unused/useerrors/useerrors.go --
    59  package useerrors
    60  import _ "errors"
    61  
    62  -- nested/go.mod --
    63  module example.com/m/nested
    64  -- nested/useencoding/useencoding.go --
    65  package useencoding
    66  import _ "encoding"