Placate lint

I think the version using scoping was better, but I'm out of energy to fight the linter.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
This commit is contained in:
Bryan Boreham 2023-06-01 18:36:34 +00:00
parent bb0d8320dd
commit 67d2ef004d
1 changed files with 9 additions and 9 deletions

View File

@ -410,11 +410,11 @@ func (ng *Engine) SetQueryLogger(l QueryLogger) {
// NewInstantQuery returns an evaluation query for the given expression at the given time. // NewInstantQuery returns an evaluation query for the given expression at the given time.
func (ng *Engine) NewInstantQuery(ctx context.Context, q storage.Queryable, opts *QueryOpts, qs string, ts time.Time) (Query, error) { func (ng *Engine) NewInstantQuery(ctx context.Context, q storage.Queryable, opts *QueryOpts, qs string, ts time.Time) (Query, error) {
pExpr, qry := ng.newQuery(q, qs, opts, ts, ts, 0) pExpr, qry := ng.newQuery(q, qs, opts, ts, ts, 0)
if finish, err := ng.queueActive(ctx, qry); err != nil { finishQueue, err := ng.queueActive(ctx, qry)
if err != nil {
return nil, err return nil, err
} else {
defer finish()
} }
defer finishQueue()
expr, err := parser.ParseExpr(qs) expr, err := parser.ParseExpr(qs)
if err != nil { if err != nil {
return nil, err return nil, err
@ -431,11 +431,11 @@ func (ng *Engine) NewInstantQuery(ctx context.Context, q storage.Queryable, opts
// the resolution set by the interval. // the resolution set by the interval.
func (ng *Engine) NewRangeQuery(ctx context.Context, q storage.Queryable, opts *QueryOpts, qs string, start, end time.Time, interval time.Duration) (Query, error) { func (ng *Engine) NewRangeQuery(ctx context.Context, q storage.Queryable, opts *QueryOpts, qs string, start, end time.Time, interval time.Duration) (Query, error) {
pExpr, qry := ng.newQuery(q, qs, opts, start, end, interval) pExpr, qry := ng.newQuery(q, qs, opts, start, end, interval)
if finish, err := ng.queueActive(ctx, qry); err != nil { finishQueue, err := ng.queueActive(ctx, qry)
if err != nil {
return nil, err return nil, err
} else {
defer finish()
} }
defer finishQueue()
expr, err := parser.ParseExpr(qs) expr, err := parser.ParseExpr(qs)
if err != nil { if err != nil {
return nil, err return nil, err
@ -595,11 +595,11 @@ func (ng *Engine) exec(ctx context.Context, q *query) (v parser.Value, ws storag
execSpanTimer, ctx := q.stats.GetSpanTimer(ctx, stats.ExecTotalTime) execSpanTimer, ctx := q.stats.GetSpanTimer(ctx, stats.ExecTotalTime)
defer execSpanTimer.Finish() defer execSpanTimer.Finish()
if finish, err := ng.queueActive(ctx, q); err != nil { finishQueue, err := ng.queueActive(ctx, q)
if err != nil {
return nil, nil, err return nil, nil, err
} else {
defer finish()
} }
defer finishQueue()
// Cancel when execution is done or an error was raised. // Cancel when execution is done or an error was raised.
defer q.cancel() defer q.cancel()