Skip to content

Commit

Permalink
Remove unused parameters
Browse files Browse the repository at this point in the history
Signed-off-by: Charlie Le <[email protected]>
  • Loading branch information
CharlieTLe committed Apr 21, 2024
1 parent 91c4810 commit df76bcc
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 14 deletions.
2 changes: 1 addition & 1 deletion cmd/cortextool/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func main() {
analyseCommand.Register(app)
bucketValidateCommand.Register(app)

app.Command("version", "Get the version of the cortextool CLI").Action(func(k *kingpin.ParseContext) error {
app.Command("version", "Get the version of the cortextool CLI").Action(func(_ *kingpin.ParseContext) error {
fmt.Print(version.Template)
version.CheckLatest()

Expand Down
4 changes: 2 additions & 2 deletions cmd/rules-migrator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"encoding/base64"
"flag"
"fmt"
"io/ioutil"
"io"
"log"
"strings"

Expand Down Expand Up @@ -75,7 +75,7 @@ func main() {
log.Fatalf("unable to load object, %v", err)
}

data, err := ioutil.ReadAll(reader)
data, err := io.ReadAll(reader)
if err != nil {
log.Fatalf("unable to read object, %v", err)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/analyse/grafana.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ func parseQuery(query string, metrics map[string]struct{}) error {
return err
}

parser.Inspect(expr, func(node parser.Node, path []parser.Node) error {
parser.Inspect(expr, func(node parser.Node, _ []parser.Node) error {
if n, ok := node.(*parser.VectorSelector); ok {
metrics[n.Name] = struct{}{}
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/analyse/ruler.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func ParseMetricsInRuleGroup(mir *MetricsInRuler, group rwrulefmt.RuleGroup, ns
continue
}

parser.Inspect(expr, func(node parser.Node, path []parser.Node) error {
parser.Inspect(expr, func(node parser.Node, _ []parser.Node) error {
if n, ok := node.(*parser.VectorSelector); ok {
refMetrics[n.Name] = struct{}{}
}
Expand Down
5 changes: 3 additions & 2 deletions pkg/chunk/gcp/gcs_scanner.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
package gcp

import (
"cloud.google.com/go/storage"
"context"
"fmt"
"io"

"cloud.google.com/go/storage"
"github.com/cortexproject/cortex/pkg/chunk"
"github.com/cortexproject/cortex/pkg/chunk/gcp"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"google.golang.org/api/iterator"
"io"

chunkTool "github.com/cortexproject/cortex-tools/pkg/chunk"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/chunk/migrate/reader/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ func (r *Reader) readLoop(ctx context.Context, outChan chan cortex_chunk.Chunk,
"shard": req.Prefix})

logEntry.Infoln("attempting scan request")
err := r.scanner.Scan(ctx, req, func(i cortex_chunk.Chunk) bool {
err := r.scanner.Scan(ctx, req, func(_ cortex_chunk.Chunk) bool {
// while this does not mean chunk is sent by scanner, this is the closest we can get
SentChunks.Inc()
return true
Expand Down
3 changes: 2 additions & 1 deletion pkg/client/alerts.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ package client

import (
"context"
"io"

"github.com/pkg/errors"
log "github.com/sirupsen/logrus"
"gopkg.in/yaml.v3"
"io"
)

const alertmanagerAPIPath = "/api/v1/alerts"
Expand Down
4 changes: 2 additions & 2 deletions pkg/client/rules_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
func TestCortexClient_DeleteRuleGroup(t *testing.T) {
requestCh := make(chan *http.Request, 1)

ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
ts := httptest.NewServer(http.HandlerFunc(func(_ http.ResponseWriter, r *http.Request) {
requestCh <- r
}))
defer ts.Close()
Expand Down Expand Up @@ -76,7 +76,7 @@ func TestCortexClient_DeleteRuleGroup(t *testing.T) {
func TestCortexClient_DeleteRuleNamespace(t *testing.T) {
requestCh := make(chan *http.Request, 1)

ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
ts := httptest.NewServer(http.HandlerFunc(func(_ http.ResponseWriter, r *http.Request) {
requestCh <- r
}))
defer ts.Close()
Expand Down
2 changes: 1 addition & 1 deletion pkg/commands/rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ func (r *RuleCommand) prepare(_ *kingpin.ParseContext) error {
}

// Do not apply the aggregation label to excluded rule groups.
applyTo := func(group rwrulefmt.RuleGroup, rule rulefmt.RuleNode) bool {
applyTo := func(group rwrulefmt.RuleGroup, _ rulefmt.RuleNode) bool {
_, excluded := r.aggregationLabelExcludedRuleGroupsList[group.Name]
return !excluded
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/rules/rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ func (r RuleNamespace) AggregateBy(label string, applyTo func(group rwrulefmt.Ru
// exprNodeInspectorFunc returns a PromQL inspector.
// It modifies most PromQL expressions to include a given label.
func exprNodeInspectorFunc(rule rulefmt.RuleNode, label string) func(node parser.Node, path []parser.Node) error {
return func(node parser.Node, path []parser.Node) error {
return func(node parser.Node, _ []parser.Node) error {
var err error
switch n := node.(type) {
case *parser.AggregateExpr:
Expand Down
2 changes: 1 addition & 1 deletion pkg/rules/rules_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ func TestAggregateBy(t *testing.T) {
},
},
},
applyTo: func(group rwrulefmt.RuleGroup, rule rulefmt.RuleNode) bool {
applyTo: func(group rwrulefmt.RuleGroup, _ rulefmt.RuleNode) bool {
return group.Name != "CountSkipped"
},
expectedExpr: []string{`count by(namespace, cluster) (test_series) > 1`, `count by(namespace) (test_series) > 1`},
Expand Down

0 comments on commit df76bcc

Please sign in to comment.