From c1578391cc2089cd224fd8325c333038e0ba7b7b Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Fri, 31 Mar 2023 18:01:47 -0600 Subject: maps: Add HasKey and HaveAnyKeysInCommon functions, use them --- lib/textui/log.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib/textui') diff --git a/lib/textui/log.go b/lib/textui/log.go index e8325c2..e5d3f60 100644 --- a/lib/textui/log.go +++ b/lib/textui/log.go @@ -26,6 +26,8 @@ import ( "git.lukeshu.com/go/typedsync" "github.com/datawire/dlib/dlog" "github.com/spf13/pflag" + + "git.lukeshu.com/btrfs-progs-ng/lib/maps" ) type LogLevelFlag struct { @@ -201,7 +203,7 @@ func (l *logger) log(lvl dlog.LogLevel, writeMsg func(io.Writer)) { fields := make(map[string]any) var fieldKeys []string for f := l; f.parent != nil; f = f.parent { - if _, exists := fields[f.fieldKey]; exists { + if maps.HasKey(fields, f.fieldKey) { continue } fields[f.fieldKey] = f.fieldVal -- cgit v1.2.3-2-g168b