@@ -38,11 +38,11 @@ func bind(ctx *macaron.Context, obj interface{}, ifacePtr ...interface{}) {
3838 if ctx .Req .Method == "POST" || ctx .Req .Method == "PUT" || ctx .Req .Method == "PATCH" || ctx .Req .Method == "DELETE" {
3939 switch {
4040 case strings .Contains (contentType , "form-urlencoded" ):
41- ctx .Invoke (Form (obj , ifacePtr ... ))
41+ _ , _ = ctx .Invoke (Form (obj , ifacePtr ... ))
4242 case strings .Contains (contentType , "multipart/form-data" ):
43- ctx .Invoke (MultipartForm (obj , ifacePtr ... ))
43+ _ , _ = ctx .Invoke (MultipartForm (obj , ifacePtr ... ))
4444 case strings .Contains (contentType , "json" ):
45- ctx .Invoke (Json (obj , ifacePtr ... ))
45+ _ , _ = ctx .Invoke (Json (obj , ifacePtr ... ))
4646 default :
4747 var errors Errors
4848 if contentType == "" {
@@ -54,7 +54,7 @@ func bind(ctx *macaron.Context, obj interface{}, ifacePtr ...interface{}) {
5454 ctx .Map (obj ) // Map a fake struct so handler won't panic.
5555 }
5656 } else {
57- ctx .Invoke (Form (obj , ifacePtr ... ))
57+ _ , _ = ctx .Invoke (Form (obj , ifacePtr ... ))
5858 }
5959}
6060
@@ -83,7 +83,7 @@ func errorHandler(errs Errors, rw http.ResponseWriter) {
8383 rw .WriteHeader (STATUS_UNPROCESSABLE_ENTITY )
8484 }
8585 errOutput , _ := json .Marshal (errs )
86- rw .Write (errOutput )
86+ _ , _ = rw .Write (errOutput )
8787 return
8888 }
8989}
@@ -103,11 +103,11 @@ func Bind(obj interface{}, ifacePtr ...interface{}) macaron.Handler {
103103 return func (ctx * macaron.Context ) {
104104 bind (ctx , obj , ifacePtr ... )
105105 if handler , ok := obj .(ErrorHandler ); ok {
106- ctx .Invoke (handler .Error )
106+ _ , _ = ctx .Invoke (handler .Error )
107107 } else if CustomErrorHandler != nil {
108- ctx .Invoke (CustomErrorHandler )
108+ _ , _ = ctx .Invoke (CustomErrorHandler )
109109 } else {
110- ctx .Invoke (errorHandler )
110+ _ , _ = ctx .Invoke (errorHandler )
111111 }
112112 }
113113}
@@ -176,7 +176,7 @@ func MultipartForm(formStruct interface{}, ifacePtr ...interface{}) macaron.Hand
176176 }
177177
178178 if ctx .Req .Form == nil {
179- ctx .Req .ParseForm ()
179+ _ = ctx .Req .ParseForm ()
180180 }
181181 for k , v := range form .Value {
182182 ctx .Req .Form [k ] = append (ctx .Req .Form [k ], v ... )
@@ -284,8 +284,8 @@ func Validate(obj interface{}) macaron.Handler {
284284}
285285
286286var (
287- AlphaDashPattern = regexp .MustCompile (" [^\\ d \\ w-_]" )
288- AlphaDashDotPattern = regexp .MustCompile (" [^\\ d \\ w-_\\ .]" )
287+ AlphaDashPattern = regexp .MustCompile (` [^\d\ w-_]` )
288+ AlphaDashDotPattern = regexp .MustCompile (` [^\d\ w-_\.]` )
289289 EmailPattern = regexp .MustCompile ("[\\ w!#$%&'*+/=?^_`{|}~-]+(?:\\ .[\\ w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\\ w](?:[\\ w-]*[\\ w])?\\ .)+[a-zA-Z0-9](?:[\\ w-]*[\\ w])?" )
290290)
291291
@@ -744,7 +744,7 @@ func ensureNotPointer(obj interface{}) {
744744// with errors from deserialization, then maps both the
745745// resulting struct and the errors to the context.
746746func validateAndMap (obj reflect.Value , ctx * macaron.Context , errors Errors , ifacePtr ... interface {}) {
747- ctx .Invoke (Validate (obj .Interface ()))
747+ _ , _ = ctx .Invoke (Validate (obj .Interface ()))
748748 errors = append (errors , getErrors (ctx )... )
749749 ctx .Map (errors )
750750 ctx .Map (obj .Elem ().Interface ())
0 commit comments