fix linter warnings

This commit is contained in:
Travis 2020-03-10 14:36:55 -05:00
parent cbf80370cb
commit 3b676a7cbd
2 changed files with 9 additions and 3 deletions

View file

@ -59,7 +59,9 @@ func (p *parser) Parse() (*Query, error) {
p.PQL = PQL{
Buffer: string(buf),
}
p.Init()
if err := p.Init(); err != nil {
return nil, errors.Wrap(err, "initializing")
}
err = p.PQL.Parse()
if err != nil {
return nil, errors.Wrap(err, "parsing")

View file

@ -24,7 +24,9 @@ import (
func TestPEG(t *testing.T) {
p := PQL{Buffer: `
SetBit(Union(Zitmap(row==4), Intersect(Qitmap(blah>4), Ritmap(field="http://zoo9.com=\\'hello' and \"hello\"")), Hitmap(row=ag-bee)), a="4z", b=5) Count(Union(Witmap(row=5.73, frame=.10), Row(zztop><[2, 9]))) TopN(blah, fields=["hello", "goodbye", "zero"])`[1:]}
p.Init()
if err := p.Init(); err != nil {
t.Fatalf("initialization error: %v", err)
}
err := p.Parse()
if err != nil {
t.Fatalf("parse error: %v", err)
@ -32,7 +34,9 @@ SetBit(Union(Zitmap(row==4), Intersect(Qitmap(blah>4), Ritmap(field="http://zoo9
p.Execute()
p = PQL{Buffer: `SetRowAttrs(attr="http://zoo9.com=\\'hello' "and \"hello\"")`}
p.Init()
if err := p.Init(); err != nil {
t.Fatalf("initialization error: %v", err)
}
err = p.Parse()
if err == nil {
t.Fatalf("should have been an error because of the interior unescaped double quote")