diff --git a/struct_level.go b/struct_level.go index 921a544..e721841 100644 --- a/struct_level.go +++ b/struct_level.go @@ -105,8 +105,8 @@ func (v *validate) ReportError(field interface{}, fieldName, structFieldName, ta structFieldName = fieldName } - ns := append(v.slNs, fieldName...) - nsStruct := append(v.slStructNs, structFieldName...) + v.slNs = append(v.slNs, fieldName...) + v.slStructNs = append(v.slStructNs, structFieldName...) switch kind { case reflect.Invalid: @@ -115,8 +115,8 @@ func (v *validate) ReportError(field interface{}, fieldName, structFieldName, ta &fieldError{ tag: tag, actualTag: tag, - ns: string(ns), - structNs: string(nsStruct), + ns: string(v.slNs), + structNs: string(v.slStructNs), field: fieldName, structField: structFieldName, // param: "", @@ -130,8 +130,8 @@ func (v *validate) ReportError(field interface{}, fieldName, structFieldName, ta &fieldError{ tag: tag, actualTag: tag, - ns: string(ns), - structNs: string(nsStruct), + ns: string(v.slNs), + structNs: string(v.slStructNs), field: fieldName, structField: structFieldName, value: fv.Interface(), diff --git a/validator_instance.go b/validator_instance.go index 1e6b53d..f09ebaa 100644 --- a/validator_instance.go +++ b/validator_instance.go @@ -90,7 +90,6 @@ func New() *Validate { New: func() interface{} { return &validate{ v: v, - errs: make(ValidationErrors, 0, 4), ns: make([]byte, 0, 64), actualNs: make([]byte, 0, 64), misc: make([]byte, 32),