github.com/zxy12/go_duplicate_112_new@v0.0.0-20200807091221-747231827200/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  # 'go list ./...' should not try to resolve the main module.
    38  cd ../empty
    39  go list -deps ./...
    40  ! stdout .
    41  ! stderr 'finding'
    42  stderr -count=1 '^go: warning: "./..." matched no packages'
    43  
    44  -- m/go.mod --
    45  module example.com/m
    46  
    47  require example.com/unused v0.0.0 // indirect
    48  replace example.com/unused => ../unused
    49  
    50  require example.com/m/nested v0.0.0 // indirect
    51  replace example.com/m/nested => ../nested
    52  
    53  -- m/useC/useC.go --
    54  package useC
    55  import _ "C" // "C" is a pseudo-package, not an actual one
    56  -- m/useunicode/useunicode.go --
    57  package useunicode
    58  import _ "unicode"
    59  -- m/useunsafe/useunsafe.go --
    60  package useunsafe
    61  import _ "unsafe"
    62  
    63  -- unused/go.mod --
    64  module example.com/unused
    65  -- unused/useerrors/useerrors.go --
    66  package useerrors
    67  import _ "errors"
    68  
    69  -- nested/go.mod --
    70  module example.com/m/nested
    71  -- nested/useencoding/useencoding.go --
    72  package useencoding
    73  import _ "encoding"
    74  
    75  -- empty/go.mod --
    76  module example.com/empty