Skip to content

Commit

Permalink
Fix golint warnings in utils.go (gin-gonic#1209)
Browse files Browse the repository at this point in the history
  • Loading branch information
steambap authored and appleboy committed Dec 25, 2017
1 parent a816f9e commit 6626358
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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) {
Expand Down

0 comments on commit 6626358

Please sign in to comment.