diff options
author | Daniel Milde <daniel@milde.cz> | 2021-02-21 23:34:25 +0100 |
---|---|---|
committer | Daniel Milde <daniel@milde.cz> | 2021-02-21 23:34:25 +0100 |
commit | 464b31a00ada8e2c00695452df86f53de286cdc2 (patch) | |
tree | 6198f206a15807c334521f0a62aeda646dcec907 /stdout | |
parent | cd01d445b428d70dfa2cb8196cc978be47d2d9d9 (diff) |
use struct{} in stdout
Diffstat (limited to 'stdout')
-rw-r--r-- | stdout/stdout.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/stdout/stdout.go b/stdout/stdout.go index ba4d2a7..7bf5c8c 100644 --- a/stdout/stdout.go +++ b/stdout/stdout.go @@ -18,7 +18,7 @@ import ( type UI struct { analyzer analyze.Analyzer output io.Writer - ignoreDirPaths map[string]bool + ignoreDirPaths map[string]struct{} useColors bool showProgress bool showApparentSize bool @@ -170,15 +170,16 @@ func (ui *UI) AnalyzePath(path string, _ *analyze.File) { // SetIgnoreDirPaths sets paths to ignore func (ui *UI) SetIgnoreDirPaths(paths []string) { - ui.ignoreDirPaths = make(map[string]bool, len(paths)) + ui.ignoreDirPaths = make(map[string]struct{}, len(paths)) for _, path := range paths { - ui.ignoreDirPaths[path] = true + ui.ignoreDirPaths[path] = struct{}{} } } // ShouldDirBeIgnored returns true if given path should be ignored func (ui *UI) ShouldDirBeIgnored(path string) bool { - return ui.ignoreDirPaths[path] + _, ok := ui.ignoreDirPaths[path] + return ok } func (ui *UI) updateProgress() { |