Debian Codegraph @

refactor/eg/testdata/f.txtar

raw
1
2 -- go.mod --
3 module example.com
4 go 1.18
5
6 -- template/template.go --
7 package template
8
9 // Test
10
11 import "sync"
12
13 func before(s sync.RWMutex) { s.Lock() }
14 func after(s sync.RWMutex) { s.RLock() }
15
16 -- in/f1/f1.go --
17 package F1
18
19 import "sync"
20
21 func example(n int) {
22 var x struct {
23 mutex sync.RWMutex
24 }
25
26 var y struct {
27 sync.RWMutex
28 }
29
30 type l struct {
31 sync.RWMutex
32 }
33
34 var z struct {
35 l
36 }
37
38 var a struct {
39 *l
40 }
41
42 var b struct{ Lock func() }
43
44 // Match
45 x.mutex.Lock()
46
47 // Match
48 y.Lock()
49
50 // Match indirect
51 z.Lock()
52
53 // Should be no match however currently matches due to:
54 // https://golang.org/issue/8584
55 // Will start failing when this is fixed then just change golden to
56 // No match pointer indirect
57 // a.Lock()
58 a.Lock()
59
60 // No match
61 b.Lock()
62 }
63
64 -- out/f1/f1.go --
65 package F1
66
67 import "sync"
68
69 func example(n int) {
70 var x struct {
71 mutex sync.RWMutex
72 }
73
74 var y struct {
75 sync.RWMutex
76 }
77
78 type l struct {
79 sync.RWMutex
80 }
81
82 var z struct {
83 l
84 }
85
86 var a struct {
87 *l
88 }
89
90 var b struct{ Lock func() }
91
92 // Match
93 x.mutex.RLock()
94
95 // Match
96 y.RLock()
97
98 // Match indirect
99 z.RLock()
100
101 // Should be no match however currently matches due to:
102 // https://golang.org/issue/8584
103 // Will start failing when this is fixed then just change golden to
104 // No match pointer indirect
105 // a.Lock()
106 a.RLock()
107
108 // No match
109 b.Lock()
110 }