forked from mirror/gin
Fix golint warnings in utils.go (#1209)
This commit is contained in:
parent
a816f9e9db
commit
6626358d4f
11
utils.go
11
utils.go
|
@ -33,18 +33,23 @@ func Bind(val interface{}) HandlerFunc {
|
|||
}
|
||||
}
|
||||
|
||||
// WrapF is a helper function for wrapping http.HandlerFunc
|
||||
// Returns a Gin middleware
|
||||
func WrapF(f http.HandlerFunc) HandlerFunc {
|
||||
return func(c *Context) {
|
||||
f(c.Writer, c.Request)
|
||||
}
|
||||
}
|
||||
|
||||
// WrapH is a helper function for wrapping http.Handler
|
||||
// Returns a Gin middleware
|
||||
func WrapH(h http.Handler) HandlerFunc {
|
||||
return func(c *Context) {
|
||||
h.ServeHTTP(c.Writer, c.Request)
|
||||
}
|
||||
}
|
||||
|
||||
// H is a shortcup for map[string]interface{}
|
||||
type H map[string]interface{}
|
||||
|
||||
// MarshalXML allows type H to be used with xml.Marshal.
|
||||
|
@ -65,10 +70,8 @@ func (h H) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
|
|||
return err
|
||||
}
|
||||
}
|
||||
if err := e.EncodeToken(xml.EndElement{Name: start.Name}); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
|
||||
return e.EncodeToken(xml.EndElement{Name: start.Name})
|
||||
}
|
||||
|
||||
func assert1(guard bool, text string) {
|
||||
|
|
Loading…
Reference in New Issue