Fixes integration with "go-validate-yourself"

http://stackoverflow.com/questions/29138591/hiding-nil-values-understanding-why-golang-fails-here
This commit is contained in:
Manu Mtz-Almeida 2015-04-07 16:06:53 +02:00
parent ee3b67eda1
commit a887e395f3
4 changed files with 16 additions and 4 deletions

View File

@ -19,5 +19,8 @@ func (_ getFormBinding) Bind(req *http.Request, obj interface{}) error {
if err := mapForm(obj, req.Form); err != nil {
return err
}
return _validator.ValidateStruct(obj)
if err := _validator.ValidateStruct(obj); err != nil {
return error(err)
}
return nil
}

View File

@ -21,5 +21,8 @@ func (_ jsonBinding) Bind(req *http.Request, obj interface{}) error {
if err := decoder.Decode(obj); err != nil {
return err
}
return _validator.ValidateStruct(obj)
if err := _validator.ValidateStruct(obj); err != nil {
return error(err)
}
return nil
}

View File

@ -19,5 +19,8 @@ func (_ postFormBinding) Bind(req *http.Request, obj interface{}) error {
if err := mapForm(obj, req.PostForm); err != nil {
return err
}
return _validator.ValidateStruct(obj)
if err := _validator.ValidateStruct(obj); err != nil {
return error(err)
}
return nil
}

View File

@ -20,5 +20,8 @@ func (_ xmlBinding) Bind(req *http.Request, obj interface{}) error {
if err := decoder.Decode(obj); err != nil {
return err
}
return _validator.ValidateStruct(obj)
if err := _validator.ValidateStruct(obj); err != nil {
return error(err)
}
return nil
}