diff --git a/pkg/logql/syntax/ast.go b/pkg/logql/syntax/ast.go index 95c99eef6d110..51bee23b01a9a 100644 --- a/pkg/logql/syntax/ast.go +++ b/pkg/logql/syntax/ast.go @@ -80,7 +80,7 @@ func ExtractLabelFiltersBeforeParser(e Expr) []*LabelFilterExpr { ) visitor := &DepthFirstTraversal{ - VisitLabelFilterFn: func(v RootVisitor, e *LabelFilterExpr) { + VisitLabelFilterFn: func(_ RootVisitor, e *LabelFilterExpr) { if !foundParseStage { filters = append(filters, e) } @@ -94,13 +94,13 @@ func ExtractLabelFiltersBeforeParser(e Expr) []*LabelFilterExpr { // expression is added without updating this list, blooms can silently // misbehave. - VisitLogfmtParserFn: func(v RootVisitor, e *LogfmtParserExpr) { foundParseStage = true }, - VisitLabelParserFn: func(v RootVisitor, e *LabelParserExpr) { foundParseStage = true }, - VisitJSONExpressionParserFn: func(v RootVisitor, e *JSONExpressionParser) { foundParseStage = true }, - VisitLogfmtExpressionParserFn: func(v RootVisitor, e *LogfmtExpressionParser) { foundParseStage = true }, - VisitLabelFmtFn: func(v RootVisitor, e *LabelFmtExpr) { foundParseStage = true }, - VisitKeepLabelFn: func(v RootVisitor, e *KeepLabelsExpr) { foundParseStage = true }, - VisitDropLabelsFn: func(v RootVisitor, e *DropLabelsExpr) { foundParseStage = true }, + VisitLogfmtParserFn: func(_ RootVisitor, _ *LogfmtParserExpr) { foundParseStage = true }, + VisitLabelParserFn: func(_ RootVisitor, _ *LabelParserExpr) { foundParseStage = true }, + VisitJSONExpressionParserFn: func(_ RootVisitor, _ *JSONExpressionParser) { foundParseStage = true }, + VisitLogfmtExpressionParserFn: func(_ RootVisitor, _ *LogfmtExpressionParser) { foundParseStage = true }, + VisitLabelFmtFn: func(_ RootVisitor, _ *LabelFmtExpr) { foundParseStage = true }, + VisitKeepLabelFn: func(_ RootVisitor, _ *KeepLabelsExpr) { foundParseStage = true }, + VisitDropLabelsFn: func(_ RootVisitor, _ *DropLabelsExpr) { foundParseStage = true }, } e.Accept(visitor) return filters diff --git a/pkg/querier/queryrange/detected_fields_test.go b/pkg/querier/queryrange/detected_fields_test.go index 1a967f77c069d..b82f3a4a70de1 100644 --- a/pkg/querier/queryrange/detected_fields_test.go +++ b/pkg/querier/queryrange/detected_fields_test.go @@ -969,7 +969,7 @@ func TestQuerier_DetectedFields(t *testing.T) { limitedHandler := func(stream logproto.Stream) base.Handler { return base.HandlerFunc( - func(ctx context.Context, req base.Request) (base.Response, error) { + func(_ context.Context, _ base.Request) (base.Response, error) { return &LokiResponse{ Status: "success", Data: LokiData{ @@ -985,7 +985,7 @@ func TestQuerier_DetectedFields(t *testing.T) { logHandler := func(stream logproto.Stream) base.Handler { return base.HandlerFunc( - func(ctx context.Context, req base.Request) (base.Response, error) { + func(_ context.Context, _ base.Request) (base.Response, error) { return &LokiResponse{ Status: "success", Data: LokiData{ @@ -1028,7 +1028,7 @@ func TestQuerier_DetectedFields(t *testing.T) { limitedHandler(mockLogfmtStreamWithLabels(1, 5, `{type="test", name="foo"}`)), logHandler(mockLogfmtStreamWithLabels(1, 5, `{type="test", name="foo"}`)), limits, - ).Wrap(base.HandlerFunc(func(ctx context.Context, req base.Request) (base.Response, error) { + ).Wrap(base.HandlerFunc(func(_ context.Context, _ base.Request) (base.Response, error) { t.Fatal("should not be called") return nil, nil })) @@ -1058,7 +1058,7 @@ func TestQuerier_DetectedFields(t *testing.T) { limitedHandler(mockLogfmtStreamWithLabelsAndStructuredMetadata(1, 5, `{type="test", name="bob"}`)), logHandler(mockLogfmtStreamWithLabelsAndStructuredMetadata(1, 5, `{type="test", name="bob"}`)), limits, - ).Wrap(base.HandlerFunc(func(ctx context.Context, req base.Request) (base.Response, error) { + ).Wrap(base.HandlerFunc(func(_ context.Context, _ base.Request) (base.Response, error) { t.Fatal("should not be called") return nil, nil })) @@ -1090,7 +1090,7 @@ func TestQuerier_DetectedFields(t *testing.T) { limitedHandler(mockLogfmtStreamWithLabels(1, 2, `{type="test", name="foo"}`)), logHandler(mockLogfmtStreamWithLabels(1, 2, `{type="test", name="foo"}`)), limits, - ).Wrap(base.HandlerFunc(func(ctx context.Context, req base.Request) (base.Response, error) { + ).Wrap(base.HandlerFunc(func(_ context.Context, _ base.Request) (base.Response, error) { t.Fatal("should not be called") return nil, nil })) @@ -1136,7 +1136,7 @@ func TestQuerier_DetectedFields(t *testing.T) { ), logHandler(mockLogfmtStreamWithLabelsAndStructuredMetadata(1, 2, `{type="test"}`)), limits, - ).Wrap(base.HandlerFunc(func(ctx context.Context, req base.Request) (base.Response, error) { + ).Wrap(base.HandlerFunc(func(_ context.Context, _ base.Request) (base.Response, error) { t.Fatal("should not be called") return nil, nil })) @@ -1188,7 +1188,7 @@ func TestQuerier_DetectedFields(t *testing.T) { ), logHandler(mockLogfmtStreamWithLabelsAndStructuredMetadata(1, 2, `{type="test", name="bob"}`)), limits, - ).Wrap(base.HandlerFunc(func(ctx context.Context, req base.Request) (base.Response, error) { + ).Wrap(base.HandlerFunc(func(_ context.Context, _ base.Request) (base.Response, error) { t.Fatal("should not be called") return nil, nil }))