mirror of
https://github.com/prymitive/karma
synced 2026-05-07 03:26:52 +00:00
Merge pull request #94 from cloudflare/timer-logs
Fix race condition in the matcher code
This commit is contained in:
@@ -23,10 +23,6 @@ type abstractMatcher struct {
|
||||
Operator string
|
||||
}
|
||||
|
||||
func (matcher *abstractMatcher) setOperator(operator string) {
|
||||
matcher.Operator = operator
|
||||
}
|
||||
|
||||
func (matcher *abstractMatcher) GetOperator() string {
|
||||
return matcher.Operator
|
||||
}
|
||||
@@ -123,7 +119,6 @@ func (matcher *negativeRegexMatcher) Compare(valA, valB interface{}) bool {
|
||||
|
||||
func newMatcher(matchType string) (matcherT, error) {
|
||||
if m, found := matcherConfig[matchType]; found {
|
||||
m.setOperator(matchType)
|
||||
return m, nil
|
||||
}
|
||||
e := fmt.Sprintf("%s not matched with any know match type", matchType)
|
||||
|
||||
@@ -21,12 +21,12 @@ var matcherRegex = "[=!<>~]+"
|
||||
var filterRegex = "^(@)?[a-zA-Z_][a-zA-Z0-9_]*"
|
||||
|
||||
var matcherConfig = map[string]matcherT{
|
||||
equalOperator: &equalMatcher{},
|
||||
notEqualOperator: ¬EqualMatcher{},
|
||||
moreThanOperator: &moreThanMatcher{},
|
||||
lessThanOperator: &lessThanMatcher{},
|
||||
regexpOperator: ®expMatcher{},
|
||||
negativeRegexOperator: &negativeRegexMatcher{},
|
||||
equalOperator: &equalMatcher{abstractMatcher{Operator: equalOperator}},
|
||||
notEqualOperator: ¬EqualMatcher{abstractMatcher{Operator: notEqualOperator}},
|
||||
moreThanOperator: &moreThanMatcher{abstractMatcher{Operator: moreThanOperator}},
|
||||
lessThanOperator: &lessThanMatcher{abstractMatcher{Operator: lessThanOperator}},
|
||||
regexpOperator: ®expMatcher{abstractMatcher{Operator: regexpOperator}},
|
||||
negativeRegexOperator: &negativeRegexMatcher{abstractMatcher{Operator: negativeRegexOperator}},
|
||||
}
|
||||
|
||||
type filterConfig struct {
|
||||
|
||||
Reference in New Issue
Block a user