From 7fdb62c25316e164252228181cd50427276ba098 Mon Sep 17 00:00:00 2001 From: Dmitry Savintsev Date: Wed, 11 May 2016 14:20:36 +0200 Subject: [PATCH] fix several minor golint style issues --- notifier/notifier.go | 4 ++-- promql/lex.go | 3 +-- promql/parse.go | 21 ++++++++++----------- storage/remote/graphite/client.go | 2 +- 4 files changed, 14 insertions(+), 16 deletions(-) diff --git a/notifier/notifier.go b/notifier/notifier.go index 87c20d423..4bc0f0581 100644 --- a/notifier/notifier.go +++ b/notifier/notifier.go @@ -42,7 +42,7 @@ const ( subsystem = "notifications" ) -// Handler is responsible for dispatching alert notifications to an +// Notifier is responsible for dispatching alert notifications to an // alert manager service. type Notifier struct { queue model.Alerts @@ -61,7 +61,7 @@ type Notifier struct { queueCapacity prometheus.Metric } -// HandlerOptions are the configurable parameters of a Handler. +// Options are the configurable parameters of a Handler. type Options struct { AlertmanagerURL string QueueCapacity int diff --git a/promql/lex.go b/promql/lex.go index cbfa877b2..7201fbf37 100644 --- a/promql/lex.go +++ b/promql/lex.go @@ -82,8 +82,7 @@ func (i itemType) isSetOperator() bool { return false } -// Constants for operator precedence in expressions. -// +// LowestPrec is a constant for operator precedence in expressions. const LowestPrec = 0 // Non-operators. // Precedence returns the operator precedence of the binary diff --git a/promql/parse.go b/promql/parse.go index 38911775f..2ee4e7f7e 100644 --- a/promql/parse.go +++ b/promql/parse.go @@ -512,17 +512,16 @@ func (p *parser) balance(lhs Expr, op itemType, rhs Expr, vecMatching *VectorMat VectorMatching: lhsBE.VectorMatching, ReturnBool: lhsBE.ReturnBool, } - } else { - if op.isComparisonOperator() && !returnBool && rhs.Type() == model.ValScalar && lhs.Type() == model.ValScalar { - p.errorf("comparisons between scalars must use BOOL modifier") - } - return &BinaryExpr{ - Op: op, - LHS: lhs, - RHS: rhs, - VectorMatching: vecMatching, - ReturnBool: returnBool, - } + } + if op.isComparisonOperator() && !returnBool && rhs.Type() == model.ValScalar && lhs.Type() == model.ValScalar { + p.errorf("comparisons between scalars must use BOOL modifier") + } + return &BinaryExpr{ + Op: op, + LHS: lhs, + RHS: rhs, + VectorMatching: vecMatching, + ReturnBool: returnBool, } } diff --git a/storage/remote/graphite/client.go b/storage/remote/graphite/client.go index 0e7ee28af..8ce28c4a5 100644 --- a/storage/remote/graphite/client.go +++ b/storage/remote/graphite/client.go @@ -51,7 +51,7 @@ func pathFromMetric(m model.Metric, prefix string) string { // We want to sort the labels. labels := make(model.LabelNames, 0, len(m)) - for l, _ := range m { + for l := range m { labels = append(labels, l) } sort.Sort(labels)