tree: change branch indent make go lint happy
diff --git a/tree.go b/tree.go index 121d0c3..c84a489 100644 --- a/tree.go +++ b/tree.go
@@ -445,53 +445,52 @@ // without a trailing slash if a leaf exists for that path found = (fixTrailingSlash && path == "/" && n.handle != nil) return + } - } else { - n = n.children[0] + n = n.children[0] + switch n.nType { + case param: + // find param end (either '/' or path end) + k := 0 + for k < len(path) && path[k] != '/' { + k++ + } - switch n.nType { - case param: - // find param end (either '/' or path end) - k := 0 - for k < len(path) && path[k] != '/' { - k++ - } + // add param value to case insensitive path + ciPath = append(ciPath, path[:k]...) - // add param value to case insensitive path - ciPath = append(ciPath, path[:k]...) - - // we need to go deeper! - if k < len(path) { - if len(n.children) > 0 { - path = path[k:] - n = n.children[0] - continue - } else { // ... but we can't - if fixTrailingSlash && len(path) == k+1 { - return ciPath, true - } - return - } - } - - if n.handle != nil { - return ciPath, true - } else if fixTrailingSlash && len(n.children) == 1 { - // No handle found. Check if a handle for this path + a - // trailing slash exists + // we need to go deeper! + if k < len(path) { + if len(n.children) > 0 { + path = path[k:] n = n.children[0] - if n.path == "/" && n.handle != nil { - return append(ciPath, '/'), true - } + continue + } + + // ... but we can't + if fixTrailingSlash && len(path) == k+1 { + return ciPath, true } return - - case catchAll: - return append(ciPath, path...), true - - default: - panic("Invalid node type") } + + if n.handle != nil { + return ciPath, true + } else if fixTrailingSlash && len(n.children) == 1 { + // No handle found. Check if a handle for this path + a + // trailing slash exists + n = n.children[0] + if n.path == "/" && n.handle != nil { + return append(ciPath, '/'), true + } + } + return + + case catchAll: + return append(ciPath, path...), true + + default: + panic("Invalid node type") } } else { // We should have reached the node containing the handle.