-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathguru.go
46 lines (40 loc) · 804 Bytes
/
guru.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package main
import (
"os/exec"
"strings"
)
var guruModes = "callees callers callstack definition describe freevars implements peers pointsto referrers what whicherrs"
func (g *Grid) Selection() string {
return string(g.Tag.Label.Rdsel())
}
func (g *Grid) guru(label string, q0, q1 int64) (advance bool, err error) {
if !strings.HasSuffix(label, ".go") {
return true, nil
}
asel := g.Selection()
mode := ""
// scope := "."
for _, v := range strings.Fields(guruModes) {
if asel == v {
mode = v
break
}
}
if mode == "" {
return true, nil
}
data, err := exec.Command(
"guru",
// "-scope",
// scope,
mode,
addrfmt(label, q0, q1),
).CombinedOutput()
if err != nil {
g.aerr("guru: %s", err)
}
if len(data) != 0 {
g.aguru("%s", data)
}
return false, err
}