Skip to content
Snippets Groups Projects
Commit c707a4b2 authored by LaurenceLiZhixin's avatar LaurenceLiZhixin
Browse files

fix: linter

parent 9bfb265f
No related branches found
No related tags found
No related merge requests found
......@@ -72,42 +72,6 @@ func (dir *BaseDirectory) GetDirectoryUrl() *common.URL {
return dir.url
}
// SetRouters Convert url to routers and add them into dir.routerChain
func (dir *BaseDirectory) SetRouters(urls []*common.URL) {
//if len(urls) == 0 {
// return
//}
//
//routers := make([]router.PriorityRouter, 0, len(urls))
//
//rc := dir.routerChain
//
//for _, url := range urls {
// routerKey := url.GetParam(constant.ROUTER_KEY, "")
//
// if len(routerKey) == 0 {
// continue
// }
// if url.Protocol == constant.CONDITION_ROUTE_PROTOCOL {
// if !dir.isProperRouter(url) {
// continue
// }
// }
// factory := extension.GetRouterFactory(url.Protocol)
// r, err := factory.NewPriorityRouter(url, rc.GetNotifyChan())
// if err != nil {
// logger.Errorf("Create router fail. router key: %s, url:%s, error: %+v", routerKey, url.Service(), err)
// return
// }
// routers = append(routers, r)
//}
//
//logger.Infof("Init file condition router success, size: %v", len(routers))
//dir.mutex.Lock()
//rc.AddRouters(routers)
//dir.mutex.Unlock()
}
func (dir *BaseDirectory) isProperRouter(url *common.URL) bool {
app := url.GetParam(constant.APPLICATION_KEY, "")
dirApp := dir.GetUrl().GetParam(constant.APPLICATION_KEY, "")
......
......@@ -153,7 +153,7 @@ func (r *RouterChain) Process(event *config_center.ConfigChangeEvent) {
}
if event.ConfigType == remoting.EventTypeDel {
// todo delete router
}
}
......
......@@ -183,6 +183,7 @@ func newUniformRule(dubboRoute *config.DubboRoute, destinationMap map[string]map
func (u *UniformRule) route(invokers []protocol.Invoker, url *common.URL, invocation protocol.Invocation) []protocol.Invoker {
// service rule + destination -> filter
resultInvokers := make([]protocol.Invoker, 0)
var err error
matchService := false
for _, v := range u.services {
// check if match service field
......@@ -200,7 +201,7 @@ func (u *UniformRule) route(invokers []protocol.Invoker, url *common.URL, invoca
for _, rule := range u.virtualServiceRules {
if rule.match(url, invocation) {
// match this rule, do get target logic
resultInvokers, err := rule.getRuleTargetInvokers(invokers)
resultInvokers, err = rule.getRuleTargetInvokers(invokers)
if err != nil {
logger.Error("getRuleTargetInvokers from rule err = ", err)
return nil
......
......@@ -256,11 +256,11 @@ func (dir *RegistryDirectory) cacheInvokerByEvent(event *registry.ServiceEvent)
// configRouters configures dynamic routers into the router chain, but, the current impl is incorrect, see FIXME above.
func (dir *RegistryDirectory) configRouters() {
var urls []*common.URL
for _, v := range config.GetRouterURLSet().Values() {
urls = append(urls, v.(*common.URL))
}
//var urls []*common.URL
//for _, v := range config.GetRouterURLSet().Values() {
// urls = append(urls, v.(*common.URL))
//}
//
//if len(urls) > 0 {
// dir.SetRouters(urls)
//}
......
......@@ -63,7 +63,7 @@ func NewK8sCRDClient(groupName, groupVersion, namespace string, handlers ...List
SchemeBuilder := runtime.NewSchemeBuilder(newClient.addKnownTypes)
// add to scheme
if err := SchemeBuilder.AddToScheme(scheme.Scheme); err != nil {
if err = SchemeBuilder.AddToScheme(scheme.Scheme); err != nil {
logger.Error("AddToScheme failed in k8s CRD process")
return nil, err
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment