MCPcopy
hub / github.com/syncthing/syncthing / main

Function main

script/prune_mocks.go:22–44  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

20)
21
22func main() {
23 var path string
24 flag.StringVar(&path, "t", "", "Name of file to prune")
25 flag.Parse()
26
27 filepath.Walk(path, func(path string, info os.FileInfo, err error) error {
28 if err != nil {
29 log.Fatal(err)
30 }
31 if !info.Mode().IsRegular() {
32 return nil
33 }
34 err = pruneInterfaceCheck(path, info.Size())
35 if err != nil {
36 log.Fatal(err)
37 }
38 err = exec.Command("go", "tool", "goimports", "-w", path).Run()
39 if err != nil {
40 log.Fatal(err)
41 }
42 return nil
43 })
44}
45
46func pruneInterfaceCheck(path string, size int64) error {
47 fd, err := os.Open(path)

Callers

nothing calls this directly

Calls 8

pruneInterfaceCheckFunction · 0.85
ParseMethod · 0.80
FatalMethod · 0.80
WalkMethod · 0.65
IsRegularMethod · 0.65
ModeMethod · 0.65
SizeMethod · 0.65
RunMethod · 0.45

Tested by

no test coverage detected