From 0b533f264cbf6b4ef845942f0fec8b90f6914877 Mon Sep 17 00:00:00 2001 From: joeybloggs Date: Wed, 6 Jan 2016 08:46:19 -0500 Subject: [PATCH] Only set namespace prefix when using FieldNameTag --- validator.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/validator.go b/validator.go index 6861337..a24143b 100644 --- a/validator.go +++ b/validator.go @@ -487,7 +487,10 @@ func (v *Validate) tranverseStruct(topStruct reflect.Value, currentStruct reflec if useStructName { errPrefix += sName + "." - nsPrefix += sName + "." + + if v.fieldNameTag != "" { + nsPrefix += sName + "." + } } // structonly tag present don't tranverseFields