(fileName string)
| 116 | } |
| 117 | |
| 118 | func dumpGoroutineProfile(fileName string) error { |
| 119 | f, err := os.Create(fileName) |
| 120 | if err != nil { |
| 121 | return errors.Errorf("could not create goroutine profile file: %v", err) |
| 122 | } |
| 123 | defer f.Close() |
| 124 | |
| 125 | goroutineProfile := pprof.Lookup("goroutine") |
| 126 | if goroutineProfile == nil { |
| 127 | return errors.New("could not look up goroutine profile") |
| 128 | } |
| 129 | |
| 130 | return goroutineProfile.WriteTo(f, 0) |
| 131 | } |
| 132 | |
| 133 | func retainMostRecentFilesByPattern(dir, pattern string, retainCount int) error { |
| 134 | matches, err := filepath.Glob(filepath.Join(dir, pattern)) |
no test coverage detected