Skip to content
Snippets Groups Projects
Commit cecb6c01 authored by AlexStocks's avatar AlexStocks
Browse files

Imp: use var default value

parent b74087e1
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
......@@ -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]()
}
......
......@@ -21,6 +21,7 @@ import (
"sync/atomic"
"time"
)
import (
"github.com/apache/dubbo-go/common/constant"
"github.com/apache/dubbo-go/common/extension"
......
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