removed creation of a couple stack variables and creation of errors

pull/256/head
joeybloggs 9 years ago
parent a8f7aaba72
commit 8d0fd80a80
  1. 12
      struct_level.go
  2. 1
      validator_instance.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(),

@ -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),

Loading…
Cancel
Save