make go vet happy

Address `non-constant format string in call` check:
https://github.com/golang/go/issues/60529

Signed-off-by: hagen1778 <roman@victoriametrics.com>
This commit is contained in:
hagen1778 2024-08-19 21:15:33 +02:00
parent 220b1659b6
commit febba3971b
No known key found for this signature in database
GPG key ID: 3BF75F3741CA9640
3 changed files with 4 additions and 5 deletions

View file

@ -13,7 +13,7 @@ func BenchmarkMetrics(b *testing.B) {
var pi promInstant var pi promInstant
if err := pi.Unmarshal(payload); err != nil { if err := pi.Unmarshal(payload); err != nil {
b.Fatalf(err.Error()) b.Fatal(err.Error())
} }
b.Run("Instant", func(b *testing.B) { b.Run("Instant", func(b *testing.B) {
for i := 0; i < b.N; i++ { for i := 0; i < b.N; i++ {

View file

@ -115,7 +115,7 @@ func RequestHandler(w http.ResponseWriter, r *http.Request) bool {
startTime := time.Now() startTime := time.Now()
defer requestDuration.UpdateDuration(startTime) defer requestDuration.UpdateDuration(startTime)
tracerEnabled := httputils.GetBool(r, "trace") tracerEnabled := httputils.GetBool(r, "trace")
qt := querytracer.New(tracerEnabled, r.URL.Path) qt := querytracer.New(tracerEnabled, "%s", r.URL.Path)
// Limit the number of concurrent queries. // Limit the number of concurrent queries.
select { select {

View file

@ -1,7 +1,6 @@
package querytracer package querytracer
import ( import (
"fmt"
"regexp" "regexp"
"sync" "sync"
"testing" "testing"
@ -153,11 +152,11 @@ func TestTraceConcurrent(t *testing.T) {
childLocal.Done() childLocal.Done()
var wg sync.WaitGroup var wg sync.WaitGroup
for i := 0; i < 3; i++ { for i := 0; i < 3; i++ {
child := qt.NewChild(fmt.Sprintf("child %d", i)) child := qt.NewChild("child %d", i)
wg.Add(1) wg.Add(1)
go func() { go func() {
for j := 0; j < 100; j++ { for j := 0; j < 100; j++ {
child.Printf(fmt.Sprintf("message %d", j)) child.Printf("message %d", j)
} }
wg.Done() wg.Done()
}() }()