From 1dfac592047b3d2e281f7dbc3aebe04169e85d81 Mon Sep 17 00:00:00 2001 From: songzhibin97 <49082129+songzhibin97@users.noreply.github.com> Date: Sat, 21 May 2022 16:23:50 +0800 Subject: [PATCH] Update metadata.go (#2015) --- metadata/metadata.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/metadata/metadata.go b/metadata/metadata.go index 2180465d4..be1806259 100644 --- a/metadata/metadata.go +++ b/metadata/metadata.go @@ -24,8 +24,7 @@ func New(mds ...map[string]string) Metadata { // Get returns the value associated with the passed key. func (m Metadata) Get(key string) string { - k := strings.ToLower(key) - return m[k] + return m[strings.ToLower(key)] } // Set stores the key-value pair. @@ -33,15 +32,13 @@ func (m Metadata) Set(key string, value string) { if key == "" || value == "" { return } - k := strings.ToLower(key) - m[k] = value + m[strings.ToLower(key)] = value } // Range iterate over element in metadata. func (m Metadata) Range(f func(k, v string) bool) { for k, v := range m { - ret := f(k, v) - if !ret { + if !f(k, v) { break } }