use comma ok and use single line

This commit is contained in:
thinkerou 2017-07-06 21:44:06 +08:00
parent 436d8e2af9
commit e4fd2b8637
2 changed files with 2 additions and 11 deletions

View File

@ -562,15 +562,7 @@ func (c *Context) GetRawData() ([]byte, error) {
return ioutil.ReadAll(c.Request.Body)
}
func (c *Context) SetCookie(
name string,
value string,
maxAge int,
path string,
domain string,
secure bool,
httpOnly bool,
) {
func (c *Context) SetCookie(name, value string, maxAge int, path, domain string, secure, httpOnly bool) {
if path == "" {
path = "/"
}

3
gin.go
View File

@ -26,8 +26,7 @@ type HandlersChain []HandlerFunc
// Last returns the last handler in the chain. ie. the last handler is the main own.
func (c HandlersChain) Last() HandlerFunc {
length := len(c)
if length > 0 {
if length := len(c); length > 0 {
return c[length-1]
}
return nil