http://stackoverflow.com/questions/29138591/hiding-nil-values-understanding-why-golang-fails-here
@@ -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
@@ -21,5 +21,8 @@ func (_ jsonBinding) Bind(req *http.Request, obj interface{}) error {
if err := decoder.Decode(obj); err != nil {
@@ -19,5 +19,8 @@ func (_ postFormBinding) Bind(req *http.Request, obj interface{}) error {
if err := mapForm(obj, req.PostForm); err != nil {
@@ -20,5 +20,8 @@ func (_ xmlBinding) Bind(req *http.Request, obj interface{}) error {