Skip to content

Commit

Permalink
fix(gosec-G602): specify capacity when using index lookup on slices
Browse files Browse the repository at this point in the history
  • Loading branch information
Davy Jones committed Nov 21, 2023
1 parent b0feaa3 commit d5003bb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions filtering/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func (p *Parser) ParseExpression() (_ *expr.Expr, err error) {
err = p.wrapf(err, start, "expression")
}
}()
sequences := make([]*expr.Expr, 0)
sequences := make([]*expr.Expr, 0, 1)
for {
_ = p.eatTokens(TokenTypeWhitespace)
sequence, err := p.ParseSequence()
Expand Down Expand Up @@ -107,7 +107,7 @@ func (p *Parser) ParseSequence() (_ *expr.Expr, err error) {
err = p.wrapf(err, start, "sequence")
}
}()
factors := make([]*expr.Expr, 0)
factors := make([]*expr.Expr, 0, 2)
for {
factor, err := p.ParseFactor()
if err != nil {
Expand Down Expand Up @@ -145,7 +145,7 @@ func (p *Parser) ParseFactor() (_ *expr.Expr, err error) {
err = p.wrapf(err, start, "factor")
}
}()
terms := make([]*expr.Expr, 0)
terms := make([]*expr.Expr, 0, 2)
for {
term, err := p.ParseTerm()
if err != nil {
Expand Down

0 comments on commit d5003bb

Please sign in to comment.