promql: apply golint suggestions (#5066)

Signed-off-by: Matt Layher <mdlayher@gmail.com>
This commit is contained in:
Matt Layher 2019-01-08 13:26:02 -05:00 committed by Brian Brazil
parent 8cac9cbe1d
commit 43c9d9e91f
3 changed files with 10 additions and 10 deletions

View file

@ -306,11 +306,11 @@ func Walk(v Visitor, node Node, path []Node) error {
type inspector func(Node, []Node) error
func (f inspector) Visit(node Node, path []Node) (Visitor, error) {
if err := f(node, path); err == nil {
return f, nil
} else {
if err := f(node, path); err != nil {
return nil, err
}
return f, nil
}
// Inspect traverses an AST in depth-first order: It starts by calling

View file

@ -614,7 +614,7 @@ func extractFuncFromPath(p []Node) string {
return extractFuncFromPath(p[:len(p)-1])
}
func checkForSeriesSetExpansion(expr Expr, ctx context.Context) error {
func checkForSeriesSetExpansion(ctx context.Context, expr Expr) error {
switch e := expr.(type) {
case *MatrixSelector:
if e.series == nil {
@ -966,7 +966,7 @@ func (ev *evaluator) eval(expr Expr) Value {
}
sel := e.Args[matrixArgIndex].(*MatrixSelector)
if err := checkForSeriesSetExpansion(sel, ev.ctx); err != nil {
if err := checkForSeriesSetExpansion(ev.ctx, sel); err != nil {
ev.error(err)
}
mat := make(Matrix, 0, len(sel.series)) // Output matrix.
@ -1100,7 +1100,7 @@ func (ev *evaluator) eval(expr Expr) Value {
})
case *VectorSelector:
if err := checkForSeriesSetExpansion(e, ev.ctx); err != nil {
if err := checkForSeriesSetExpansion(ev.ctx, e); err != nil {
ev.error(err)
}
mat := make(Matrix, 0, len(e.series))
@ -1175,7 +1175,7 @@ func durationToInt64Millis(d time.Duration) int64 {
// vectorSelector evaluates a *VectorSelector expression.
func (ev *evaluator) vectorSelector(node *VectorSelector, ts int64) Vector {
if err := checkForSeriesSetExpansion(node, ev.ctx); err != nil {
if err := checkForSeriesSetExpansion(ev.ctx, node); err != nil {
ev.error(err)
}
@ -1249,7 +1249,7 @@ func putPointSlice(p []Point) {
// matrixSelector evaluates a *MatrixSelector expression.
func (ev *evaluator) matrixSelector(node *MatrixSelector) Matrix {
if err := checkForSeriesSetExpansion(node, ev.ctx); err != nil {
if err := checkForSeriesSetExpansion(ev.ctx, node); err != nil {
ev.error(err)
}

View file

@ -606,9 +606,9 @@ func (ll *LazyLoader) parse(input string) error {
}
ll.loadCmd = cmd
return nil
} else {
return raise(i, "invalid command %q", l)
}
return raise(i, "invalid command %q", l)
}
return errors.New("no \"load\" command found")
}