diff --git a/cluster/router/condition_router.go b/cluster/router/condition_router.go index a196ceb5771422f06a820986a02499f9fe3523dc..efae65ccb34eb8a78e281cfaf7b1fcec79b3d163 100644 --- a/cluster/router/condition_router.go +++ b/cluster/router/condition_router.go @@ -156,10 +156,13 @@ func parseRule(rule string) (map[string]MatchPair, error) { if len(rule) == 0 { return condition, nil } - var pair MatchPair + + var ( + pair MatchPair + startIndex int + ) values := gxset.NewSet() reg := regexp.MustCompile(`([&!=,]*)\s*([^&!=,\s]+)`) - var startIndex = 0 if indexTuple := reg.FindIndex([]byte(rule)); len(indexTuple) > 0 { startIndex = indexTuple[0] } @@ -227,7 +230,7 @@ func MatchCondition(pairs map[string]MatchPair, url *common.URL, param *common.U if sample == nil { return true, perrors.Errorf("url is not allowed be nil") } - result := false + var result bool for key, matchPair := range pairs { var sampleValue string diff --git a/common/extension/filter.go b/common/extension/filter.go index e2a66c7449448a2229c53eabb478f2c96a429bc7..93f7f8cf7ccc4108fe1120b685fad36a2f9f83df 100644 --- a/common/extension/filter.go +++ b/common/extension/filter.go @@ -33,7 +33,7 @@ func SetFilter(name string, v func() filter.Filter) { func GetFilter(name string) filter.Filter { if filters[name] == nil { - panic("filter for " + name + " is not existing, make sure you have import the package.") + panic("filter for " + name + " is not existing, make sure you have imported the package.") } return filters[name]() } diff --git a/filter/impl/tps/impl/tps_limit_fix_window_strategy.go b/filter/impl/tps/impl/tps_limit_fix_window_strategy.go index 7290619d5551ebe29209e7cfa717bd66442ca2df..b4dd81512e8f00af46b1f9974cdfeabe6eac2364 100644 --- a/filter/impl/tps/impl/tps_limit_fix_window_strategy.go +++ b/filter/impl/tps/impl/tps_limit_fix_window_strategy.go @@ -21,6 +21,7 @@ import ( "sync/atomic" "time" ) + import ( "github.com/apache/dubbo-go/common/constant" "github.com/apache/dubbo-go/common/extension"