| # go list should skip 'ignore' directives |
| # See golang.org/issue/42965 |
| |
| env ROOT=$WORK${/}gopath${/}src |
| |
| # no ignore directive; should not skip any directories. |
| cp go.mod.orig go.mod |
| go list -x ./... |
| stdout 'example/foo/secret' |
| stdout 'example/pkg/foo' |
| stdout 'example/pkg/fo$' |
| ! stderr 'ignoring directory' |
| |
| # ignored ./foo should be skipped. |
| cp go.mod.relative go.mod |
| go list -x ./... |
| stdout 'example/pkg/foo' |
| stdout 'example/pkg/fo$' |
| ! stdout 'example/foo/secret' |
| stderr 'ignoring directory '$ROOT''${/}'foo' |
| ! stderr 'ignoring directory '$ROOT''${/}'pkg'${/}'foo' |
| |
| # ignored foo; any foo should be skipped. |
| cp go.mod.any go.mod |
| go list -x ./... |
| stdout 'example/pkg/fo$' |
| ! stdout 'example/pkg/foo' |
| ! stdout 'example/foo/secret' |
| stderr 'ignoring directory '$ROOT''${/}'foo' |
| stderr 'ignoring directory '$ROOT''${/}'pkg'${/}'foo' |
| |
| # non-existent ignore; should not skip any directories. |
| cp go.mod.dne go.mod |
| go list -x ./... |
| stdout 'example/foo/secret' |
| stdout 'example/pkg/foo' |
| stdout 'example/pkg/fo$' |
| ! stderr 'ignoring directory' |
| |
| # ignored fo; should not skip foo/ and should skip fo/ |
| cp go.mod.partial go.mod |
| go list -x ./... |
| ! stderr 'ignoring directory '$ROOT''${/}'foo' |
| stderr 'ignoring directory '$ROOT''${/}'pkg'${/}'fo$' |
| ! stderr 'ignoring directory '$ROOT''${/}'pkg'${/}'foo' |
| |
| # ignored pkg/foo; should skip pkg/foo/ |
| cp go.mod.tree go.mod |
| go list -x ./... |
| stdout 'example/foo/secret' |
| stdout 'example/pkg/fo$' |
| stderr 'ignoring directory '$ROOT''${/}'pkg'${/}'foo' |
| |
| # ignored /pkg/foo/; should skip pkg/foo/ |
| cp go.mod.sep1 go.mod |
| go list -x ./... |
| stdout 'example/foo/secret' |
| stdout 'example/pkg/fo$' |
| stderr 'ignoring directory '$ROOT''${/}'pkg'${/}'foo' |
| |
| # ignored pkg/foo/; should skip pkg/foo/ |
| cp go.mod.sep2 go.mod |
| go list -x ./... |
| stdout 'example/foo/secret' |
| stdout 'example/pkg/fo$' |
| stderr 'ignoring directory '$ROOT''${/}'pkg'${/}'foo' |
| |
| # ignored /pkg/foo; should skip pkg/foo/ |
| cp go.mod.sep3 go.mod |
| go list -x ./... |
| stdout 'example/foo/secret' |
| stdout 'example/pkg/fo$' |
| stderr 'ignoring directory '$ROOT''${/}'pkg'${/}'foo' |
| |
| -- foo/secret/secret.go -- |
| package secret |
| |
| const Secret = "this should be ignored" |
| -- pkg/foo/foo.go -- |
| package foo |
| |
| const Bar = "Hello from foo!" |
| -- pkg/fo/fo.go -- |
| package fo |
| |
| const Gar = "Hello from fo!" |
| -- go.mod.orig -- |
| module example |
| |
| go 1.24 |
| |
| -- go.mod.relative -- |
| module example |
| |
| go 1.24 |
| |
| ignore ./foo |
| |
| -- go.mod.any -- |
| module example |
| |
| go 1.24 |
| |
| ignore foo |
| |
| -- go.mod.dne -- |
| module example |
| |
| go 1.24 |
| |
| ignore bar |
| |
| -- go.mod.partial -- |
| module example |
| |
| go 1.24 |
| |
| ignore fo |
| |
| -- go.mod.tree -- |
| module example |
| |
| go 1.24 |
| |
| ignore pkg/foo |
| |
| -- go.mod.sep1 -- |
| module example |
| |
| go 1.24 |
| |
| ignore /pkg/foo/ |
| |
| -- go.mod.sep2 -- |
| module example |
| |
| go 1.24 |
| |
| ignore pkg/foo/ |
| |
| -- go.mod.sep3 -- |
| module example |
| |
| go 1.24 |
| |
| ignore /pkg/foo |
| |
| -- main.go -- |
| package main |
| |
| func main() {} |