From edc547beaa14417aaaf336bdb09ed9d163deaf89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=AE=88=E8=99=8E?= Date: Fri, 15 Feb 2019 15:15:06 +0800 Subject: [PATCH] format code,Remove useless code --- debug.go | 2 +- gin.go | 2 +- tree.go | 6 ------ 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/debug.go b/debug.go index 586bade6..98c67cf7 100644 --- a/debug.go +++ b/debug.go @@ -6,12 +6,12 @@ package gin import ( "bytes" + "fmt" "html/template" "os" "runtime" "strconv" "strings" - "fmt" ) const ginSupportMinGoVer = 6 diff --git a/gin.go b/gin.go index 4b9264f9..24bf7d78 100644 --- a/gin.go +++ b/gin.go @@ -5,12 +5,12 @@ package gin import ( + "fmt" "html/template" "net" "net/http" "os" "sync" - "fmt" "github.com/gin-gonic/gin/render" ) diff --git a/tree.go b/tree.go index a4cc92d6..b961e3a9 100644 --- a/tree.go +++ b/tree.go @@ -94,7 +94,6 @@ type node struct { nType nodeType maxParams uint8 wildChild bool - allPath string } // increments priority of the given child and reorders if necessary. @@ -154,7 +153,6 @@ func (n *node) addRoute(path string, handlers HandlersChain) { indices: n.indices, children: n.children, handlers: n.handlers, - allPath:path, priority: n.priority - 1, } @@ -170,7 +168,6 @@ func (n *node) addRoute(path string, handlers HandlersChain) { n.indices = string([]byte{n.path[i]}) n.path = path[:i] n.handlers = nil - n.allPath=path n.wildChild = false } @@ -238,14 +235,12 @@ func (n *node) addRoute(path string, handlers HandlersChain) { n = child } n.insertChild(numParams, path, fullPath, handlers) - n.allPath=path return } else if i == len(path) { // Make node a (in-path) leaf if n.handlers != nil { panic("handlers are already registered for path '" + fullPath + "'") } - n.allPath=path n.handlers = handlers } return @@ -253,7 +248,6 @@ func (n *node) addRoute(path string, handlers HandlersChain) { } else { // Empty tree n.insertChild(numParams, path, fullPath, handlers) n.nType = root - n.allPath=path } }