MCPcopy Index your code
hub / github.com/codegangsta/gin / scanChanges

Function scanChanges

main.go:265–292  ·  view source on GitHub ↗
(watchPath string, excludeDirs []string, allFiles bool, cb scanCallback)

Source from the content-addressed store, hash-verified

263type scanCallback func(path string)
264
265func scanChanges(watchPath string, excludeDirs []string, allFiles bool, cb scanCallback) {
266 for {
267 filepath.Walk(watchPath, func(path string, info os.FileInfo, err error) error {
268 if path == ".git" && info.IsDir() {
269 return filepath.SkipDir
270 }
271 for _, x := range excludeDirs {
272 if x == path {
273 return filepath.SkipDir
274 }
275 }
276
277 // ignore hidden files
278 if filepath.Base(path)[0] == '.' {
279 return nil
280 }
281
282 if (allFiles || filepath.Ext(path) == ".go") && info.ModTime().After(startTime) {
283 cb(path)
284 startTime = time.Now()
285 return errors.New("done")
286 }
287
288 return nil
289 })
290 time.Sleep(500 * time.Millisecond)
291 }
292}
293
294func shutdown(runner gin.Runner) {
295 c := make(chan os.Signal, 2)

Callers 1

MainActionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected