From e0fd6238d3cb237d3eb4c3d13792caa265ecdf29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=94=B0=E6=AC=A7?= Date: Thu, 6 Jul 2017 22:49:54 +0800 Subject: [PATCH] use comma ok and use single line (#984) --- context.go | 10 +--------- gin.go | 3 +-- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/context.go b/context.go index 2134b8fe..604dc4ef 100644 --- a/context.go +++ b/context.go @@ -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 = "/" } diff --git a/gin.go b/gin.go index ca8d75e9..3cac936c 100644 --- a/gin.go +++ b/gin.go @@ -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