Skip to content

Commit

Permalink
Fix linter errors
Browse files Browse the repository at this point in the history
  • Loading branch information
klauspost committed Mar 8, 2024
1 parent 250734f commit 1391f44
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ func (s *Server) handleAggregated(w http.ResponseWriter, req *http.Request) {
w.Write([]byte(err.Error()))
return
}
durFn := func(total time.Duration) time.Duration {
durFn := func(time.Duration) time.Duration {
return segmentDur
}
s.mu.Lock()
Expand Down
2 changes: 1 addition & 1 deletion cli/benchclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ var (

// wsUpgrader performs websocket upgrades.
var wsUpgrader = websocket.Upgrader{
CheckOrigin: func(r *http.Request) bool {
CheckOrigin: func(_ *http.Request) bool {
return true
},
}
Expand Down
2 changes: 1 addition & 1 deletion cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ func registerApp(name string, appCmds []cli.Command) *cli.App {
return nil
}

afterExec = func(ctx *cli.Context) error {
afterExec = func(_ *cli.Context) error {
for _, profile := range profiles {
profile.Stop()
}
Expand Down
4 changes: 2 additions & 2 deletions cli/influx.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ func newInfluxDB(ctx *cli.Context, wg *sync.WaitGroup) chan<- bench.Operation {
// Use blocking write client for writes to desired bucket
path := strings.Split(strings.TrimPrefix(u.Path, "/"), "/")
writeAPI := client.WriteAPI(path[1], path[0])
writeAPI.SetWriteFailedCallback(func(batch string, error http.Error, retryAttempts uint) bool {
errorIf(probe.NewError(err), "unable to write to influxdb")
writeAPI.SetWriteFailedCallback(func(_ string, err http.Error, _ uint) bool {
errorIf(probe.NewError(&err), "unable to write to influxdb")
return false
})
ch := make(chan bench.Operation, 10000)
Expand Down
4 changes: 2 additions & 2 deletions pkg/bench/mixed.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ func (g *Mixed) Prepare(ctx context.Context) error {
var groupErr error
var mu sync.Mutex
for i := 0; i < g.Concurrency; i++ {
go func(i int) {
go func() {
defer wg.Done()
src := g.Source()

Expand Down Expand Up @@ -218,7 +218,7 @@ func (g *Mixed) Prepare(ctx context.Context) error {
g.Dist.addObj(*obj)
g.prepareProgress(float64(len(g.Dist.objects)) / float64(g.CreateObjects))
}
}(i)
}()
}
wg.Wait()
return groupErr
Expand Down
9 changes: 4 additions & 5 deletions pkg/bench/versioned.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
"io"
"math/rand"
"net/http"
"sort"
"sync"
"time"

Expand Down Expand Up @@ -75,7 +74,7 @@ func (g *Versioned) Prepare(ctx context.Context) error {
var groupErr error
var mu sync.Mutex
for i := 0; i < g.Concurrency; i++ {
go func(i int) {
go func() {
defer wg.Done()
src := g.Source()

Expand Down Expand Up @@ -123,7 +122,7 @@ func (g *Versioned) Prepare(ctx context.Context) error {
g.Dist.addObj(*obj)
g.prepareProgress(float64(len(g.Dist.objects)) / float64(g.CreateObjects))
}
}(i)
}()
}
wg.Wait()
return groupErr
Expand Down Expand Up @@ -339,8 +338,8 @@ func (m *VersionedDistribution) Generate(allocObjs int) error {
}
}
m.rng = rand.New(rand.NewSource(0xabad1dea))
sort.Slice(m.ops, func(i, j int) bool {
return m.rng.Int63()&1 == 0
m.rng.Shuffle(len(m.ops), func(i, j int) {
m.ops[i], m.ops[j] = m.ops[j], m.ops[i]
})
return nil
}
Expand Down

0 comments on commit 1391f44

Please sign in to comment.