mirror of https://github.com/gofiber/fiber.git
♻️ Refactor: the value of map is unused in uniqueRouteStack (#3320)
Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>pull/3324/head
parent
5b0a96e4f9
commit
b1e858bc76
|
@ -192,12 +192,10 @@ func (app *App) methodExistCustom(c CustomCtx) bool {
|
||||||
// uniqueRouteStack drop all not unique routes from the slice
|
// uniqueRouteStack drop all not unique routes from the slice
|
||||||
func uniqueRouteStack(stack []*Route) []*Route {
|
func uniqueRouteStack(stack []*Route) []*Route {
|
||||||
var unique []*Route
|
var unique []*Route
|
||||||
m := make(map[*Route]int)
|
m := make(map[*Route]struct{})
|
||||||
for _, v := range stack {
|
for _, v := range stack {
|
||||||
if _, ok := m[v]; !ok {
|
if _, ok := m[v]; !ok {
|
||||||
// Unique key found. Record position and collect
|
m[v] = struct{}{}
|
||||||
// in result.
|
|
||||||
m[v] = len(unique)
|
|
||||||
unique = append(unique, v)
|
unique = append(unique, v)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue