Debian Codegraph @

cmd/deadcode/testdata/issue65915.txtar

raw
1 # Regression test for issue 65915: the enumeration of source-level
2 # functions used the flawed ssautil.AllFunctions, causing it to
3 # miss some unexported ones.
4
5 deadcode -filter= example.com
6
7 want "unreachable func: example.UnUsed"
8 want "unreachable func: example.unUsed"
9 want "unreachable func: PublicExample.UnUsed"
10 want "unreachable func: PublicExample.unUsed"
11
12 -- go.mod --
13 module example.com
14 go 1.18
15
16 -- main.go --
17 package main
18
19 type example struct{}
20
21 func (e example) UnUsed() {}
22
23 func (e example) Used() {}
24
25 func (e example) unUsed() {}
26
27 func (e example) used() {}
28
29 type PublicExample struct{}
30
31 func (p PublicExample) UnUsed() {}
32
33 func (p PublicExample) Used() {}
34
35 func (p PublicExample) unUsed() {}
36
37 func (p PublicExample) used() {}
38
39 func main() {
40 example{}.Used()
41 example{}.used()
42 PublicExample{}.Used()
43 PublicExample{}.used()
44 }