removed creation of a couple stack variables and creation of errors

pull/256/head
joeybloggs 8 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 structFieldName = fieldName
} }
ns := append(v.slNs, fieldName...) v.slNs = append(v.slNs, fieldName...)
nsStruct := append(v.slStructNs, structFieldName...) v.slStructNs = append(v.slStructNs, structFieldName...)
switch kind { switch kind {
case reflect.Invalid: case reflect.Invalid:
@ -115,8 +115,8 @@ func (v *validate) ReportError(field interface{}, fieldName, structFieldName, ta
&fieldError{ &fieldError{
tag: tag, tag: tag,
actualTag: tag, actualTag: tag,
ns: string(ns), ns: string(v.slNs),
structNs: string(nsStruct), structNs: string(v.slStructNs),
field: fieldName, field: fieldName,
structField: structFieldName, structField: structFieldName,
// param: "", // param: "",
@ -130,8 +130,8 @@ func (v *validate) ReportError(field interface{}, fieldName, structFieldName, ta
&fieldError{ &fieldError{
tag: tag, tag: tag,
actualTag: tag, actualTag: tag,
ns: string(ns), ns: string(v.slNs),
structNs: string(nsStruct), structNs: string(v.slStructNs),
field: fieldName, field: fieldName,
structField: structFieldName, structField: structFieldName,
value: fv.Interface(), value: fv.Interface(),

@ -90,7 +90,6 @@ func New() *Validate {
New: func() interface{} { New: func() interface{} {
return &validate{ return &validate{
v: v, v: v,
errs: make(ValidationErrors, 0, 4),
ns: make([]byte, 0, 64), ns: make([]byte, 0, 64),
actualNs: make([]byte, 0, 64), actualNs: make([]byte, 0, 64),
misc: make([]byte, 32), misc: make([]byte, 32),

Loading…
Cancel
Save