...

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

Documentation: cmd/go/testdata/script

     1# go mod tidy should skip 'ignore' directives
     2# See golang.org/issue/42965
     3env ROOT=$WORK${/}gopath${/}src
     4
     5# no ignore directive; should not skip any directories.
     6cp go.mod.orig go.mod
     7go mod tidy -x
     8! stderr 'ignoring directory'
     9
    10# ignored ./foo should be skipped.
    11cp go.mod.relative go.mod
    12go mod tidy -x
    13stderr 'ignoring directory '$ROOT''${/}'foo'
    14! stderr 'ignoring directory '$ROOT''${/}'pkg'${/}'foo'
    15! stderr 'ignoring directory '$ROOT''${/}'pkg'${/}'fo$'
    16
    17# ignored foo; any foo should be skipped.
    18cp go.mod.any go.mod
    19go mod tidy -x
    20stderr 'ignoring directory '$ROOT''${/}'foo'
    21stderr 'ignoring directory '$ROOT''${/}'pkg'${/}'foo'
    22! stderr 'ignoring directory '$ROOT''${/}'pkg'${/}'fo$'
    23
    24# non-existent ignore; should not skip any directories.
    25cp go.mod.dne go.mod
    26go mod tidy -x
    27! stderr 'ignoring directory'
    28
    29# ignored fo; should not skip foo/ but should skip fo/
    30cp go.mod.partial go.mod
    31go mod tidy -x
    32stderr 'ignoring directory '$ROOT''${/}'pkg'${/}'fo$'
    33! stderr 'ignoring directory '$ROOT''${/}'pkg'${/}'foo'
    34-- foo/secret/secret.go --
    35package secret
    36
    37const Secret = "this should be ignored"
    38-- pkg/foo/foo.go --
    39package example/pkg/foo
    40
    41const Bar = "Hello from foo!"
    42-- pkg/fo/fo.go --
    43package fo
    44
    45const Gar = "Hello from fo!"
    46-- go.mod.orig --
    47module example
    48
    49go 1.24
    50-- go.mod.relative --
    51module example
    52
    53go 1.24
    54
    55ignore ./foo
    56-- go.mod.any --
    57module example
    58
    59go 1.24
    60
    61ignore foo
    62-- go.mod.dne --
    63module example
    64
    65go 1.24
    66
    67ignore bar
    68-- go.mod.partial --
    69module example
    70
    71go 1.24
    72
    73ignore fo
    74
    75-- main.go --
    76package main
    77
    78func main() {}

View as plain text