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

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

View as plain text