lint fixes (#14)
* lint fixes Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
@@ -126,7 +126,7 @@ func (r *rtr) manageRoute(route router.Route, action string) error {
|
||||
|
||||
// createRoutes turns a service into a list routes basically converting nodes to routes
|
||||
func (r *rtr) createRoutes(service *registry.Service, network string) []router.Route {
|
||||
var routes []router.Route
|
||||
routes := make([]router.Route, 0, len(service.Nodes))
|
||||
|
||||
for _, node := range service.Nodes {
|
||||
routes = append(routes, router.Route{
|
||||
|
@@ -262,6 +262,8 @@ func filterRoutes(routes map[uint64]*route, opts router.QueryOptions) []router.R
|
||||
// routeMap stores the routes we're going to advertise
|
||||
routeMap := make(map[string][]router.Route)
|
||||
|
||||
var routeCnt int
|
||||
|
||||
for _, rt := range routes {
|
||||
// get the actual route
|
||||
route := rt.route
|
||||
@@ -270,11 +272,11 @@ func filterRoutes(routes map[uint64]*route, opts router.QueryOptions) []router.R
|
||||
// add matchihg route to the routeMap
|
||||
routeKey := route.Service + "@" + route.Network
|
||||
routeMap[routeKey] = append(routeMap[routeKey], route)
|
||||
routeCnt++
|
||||
}
|
||||
}
|
||||
|
||||
var results []router.Route
|
||||
|
||||
results := make([]router.Route, 0, routeCnt)
|
||||
for _, route := range routeMap {
|
||||
results = append(results, route...)
|
||||
}
|
||||
|
Reference in New Issue
Block a user