From 27b607d6ad9d13f23147def53243b0263c0473df Mon Sep 17 00:00:00 2001 From: joeybloggs Date: Sat, 6 Aug 2016 14:19:33 -0400 Subject: [PATCH] avoid a couple of dive allocations --- validator.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/validator.go b/validator.go index 6806f6e..ba4a8b6 100644 --- a/validator.go +++ b/validator.go @@ -318,10 +318,12 @@ OUTER: } else { + tVal := string(v.misc)[1:] + v.errs = append(v.errs, &fieldError{ - tag: string(v.misc)[1:], - actualTag: string(v.misc)[1:], + tag: tVal, + actualTag: tVal, ns: string(append(ns, cf.altName...)), structNs: string(append(structNs, cf.name...)), field: cf.altName,