Take another approach
Signed-off-by: gotjosh <josue.abreu@gmail.com>
This commit is contained in:
parent
05f073f42f
commit
bd89550ce2
|
@ -120,18 +120,14 @@ func ParseMatcher(s string) (_ *Matcher, err error) {
|
|||
return nil, errors.Errorf("bad matcher format: %s", s)
|
||||
}
|
||||
|
||||
rawValue := ms[3]
|
||||
if len(rawValue) == 0 {
|
||||
return nil, errors.Errorf("matcher value is not present: %s", s)
|
||||
}
|
||||
|
||||
var (
|
||||
rawValue = ms[3]
|
||||
value strings.Builder
|
||||
escaped bool
|
||||
expectTrailingQuote bool
|
||||
)
|
||||
|
||||
if rawValue[0] == '"' {
|
||||
if strings.HasPrefix(rawValue, "\"") {
|
||||
rawValue = strings.TrimPrefix(rawValue, "\"")
|
||||
expectTrailingQuote = true
|
||||
}
|
||||
|
|
|
@ -191,7 +191,10 @@ func TestMatchers(t *testing.T) {
|
|||
},
|
||||
{
|
||||
input: `job=`,
|
||||
err: `matcher value is not present: job=`,
|
||||
want: func() []*Matcher {
|
||||
m, _ := NewMatcher(MatchEqual, "job", "")
|
||||
return []*Matcher{m}
|
||||
}(),
|
||||
},
|
||||
{
|
||||
input: `job="value`,
|
||||
|
|
Loading…
Reference in New Issue