feat: add track duplicate route names

This commit is contained in:
Jonas Kaninda
2024-11-18 09:20:12 +01:00
parent a9d365daa4
commit 762fbe8511
2 changed files with 22 additions and 0 deletions

View File

@@ -53,3 +53,18 @@ func loadExtraRoutes(routePath string) ([]Route, error) {
}
return extraRoutes, nil
}
func findDuplicateRouteNames(routes []Route) []string {
// Create a map to track occurrences of names
nameMap := make(map[string]int)
var duplicates []string
for _, route := range routes {
nameMap[route.Name]++
// If the count is ==2, it's a duplicate
if nameMap[route.Name] == 2 {
duplicates = append(duplicates, route.Name)
}
}
return duplicates
}