From 8f8659b3a4cf633abde7fb32b5bca50f4e3fea37 Mon Sep 17 00:00:00 2001 From: qm012 Date: Wed, 23 Jun 2021 13:34:48 +0800 Subject: [PATCH] optimization code --- cache.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cache.go b/cache.go index 78e2006..92f9f2c 100644 --- a/cache.go +++ b/cache.go @@ -165,8 +165,7 @@ func (v *Validate) extractStructCache(current reflect.Value, sName string) *cStr } // The priority of RegisterTagNameFunc is higher than the custom tag value if v.hasTagNameFunc { - value := v.tagNameFunc(fld) - if len(value) != 0 { + if value := v.tagNameFunc(fld); len(value) != 0 { tagValues[defaultErrTagName] = value } }