...

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

Documentation: cmd/go/testdata/script

     1env GO111MODULE=on
     2
     3# File system pattern searches should skip sub-modules and vendor directories.
     4cd x
     5
     6# all packages
     7go list all
     8stdout ^m$
     9stdout ^m/vendor$
    10! stdout vendor/
    11stdout ^m/y$
    12! stdout ^m/y/z
    13
    14# path pattern
    15go list m/...
    16stdout ^m$
    17stdout ^m/vendor$
    18! stdout vendor/
    19stdout ^m/y$
    20! stdout ^m/y/z
    21
    22# directory pattern
    23go list ./...
    24stdout ^m$
    25stdout ^m/vendor$
    26! stdout vendor/
    27stdout ^m/y$
    28! stdout ^m/y/z
    29
    30# non-existent directory should not prompt lookups
    31! go build -mod=readonly example.com/nonexist
    32stderr 'import lookup disabled'
    33
    34! go build -mod=readonly ./nonexist
    35! stderr 'import lookup disabled'
    36stderr '^stat '$GOPATH'[/\\]src[/\\]x[/\\]nonexist: directory not found'
    37
    38! go build -mod=readonly ./go.mod
    39! stderr 'import lookup disabled'
    40stderr 'main module \(m\) does not contain package m/go.mod'
    41
    42
    43# File system paths and patterns should allow the '@' character.
    44cd ../@at
    45go list $PWD
    46stdout '^at$'
    47go list $PWD/...
    48stdout '^at$'
    49
    50# The '@' character is not allowed in directory paths that are part of
    51# a package path.
    52cd ../badat/bad@
    53! go list .
    54stderr 'current directory outside main module or its selected dependencies'
    55! go list $PWD
    56stderr 'current directory outside main module or its selected dependencies'
    57! go list $PWD/...
    58stderr 'current directory outside main module or its selected dependencies'
    59
    60-- x/go.mod --
    61module m
    62
    63-- x/x.go --
    64package x
    65
    66-- x/vendor/v/v.go --
    67package v
    68import _ "golang.org/x/crypto"
    69
    70-- x/vendor/v.go --
    71package main
    72
    73-- x/y/y.go --
    74package y
    75
    76-- x/y/z/go.mod --
    77syntax error!
    78
    79-- x/y/z/z.go --
    80package z
    81
    82-- x/y/z/w/w.go --
    83package w
    84
    85-- @at/go.mod --
    86module at
    87
    88go 1.14
    89-- @at/at.go --
    90package at
    91
    92-- badat/go.mod --
    93module badat
    94
    95go 1.14
    96-- badat/bad@/bad.go --
    97package bad

View as plain text