Przeglądaj źródła

use comma ok and use single line (#984)

田欧 8 lat temu
rodzic
commit
e0fd6238d3
2 zmienionych plików z 2 dodań i 11 usunięć
  1. 1 9
      context.go
  2. 1 2
      gin.go

+ 1 - 9
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 = "/"
 	}

+ 1 - 2
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