cmd/deadcode/testdata/filterflag.txtar
raw| 1 | # Test of -filter flag. |
| 2 | |
| 3 | deadcode -filter=other.net example.com |
| 4 | |
| 5 | want `other.net` |
| 6 | want `Dead` |
| 7 | !want `Live` |
| 8 | |
| 9 | !want `example.com` |
| 10 | !want `unreferenced` |
| 11 | |
| 12 | -- go.work -- |
| 13 | use example.com |
| 14 | use other.net |
| 15 | |
| 16 | -- example.com/go.mod -- |
| 17 | module example.com |
| 18 | go 1.18 |
| 19 | |
| 20 | -- example.com/main.go -- |
| 21 | package main |
| 22 | |
| 23 | import "other.net" |
| 24 | |
| 25 | func main() { |
| 26 | other.Live() |
| 27 | } |
| 28 | |
| 29 | func unreferenced() {} |
| 30 | |
| 31 | -- other.net/go.mod -- |
| 32 | module other.net |
| 33 | go 1.18 |
| 34 | |
| 35 | -- other.net/other.go -- |
| 36 | package other |
| 37 | |
| 38 | func Live() {} |
| 39 | func Dead() {} |