From 0557e8cc0fd9479811b8cc24b5554d54be1f9cc0 Mon Sep 17 00:00:00 2001 From: qshuai Date: Sun, 8 Mar 2020 15:35:14 +0800 Subject: [PATCH] Preassign map size --- watcher.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/watcher.go b/watcher.go index 4da4dfe..fc465df 100644 --- a/watcher.go +++ b/watcher.go @@ -433,7 +433,7 @@ func (w *Watcher) WatchedFiles() map[string]os.FileInfo { w.mu.Lock() defer w.mu.Unlock() - files := make(map[string]os.FileInfo) + files := make(map[string]os.FileInfo, len(w.files)) for k, v := range w.files { files[k] = v }