From 2957a32aff6ee1bfeaaed72eff79ba9642cfb3b0 Mon Sep 17 00:00:00 2001 From: Daulet Zhanguzin Date: Wed, 20 Nov 2024 17:51:12 -0800 Subject: [PATCH] fix: linter issues --- bench_server/main.go | 2 -- print.go | 7 ++++--- requester.go | 13 +++++++------ 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/bench_server/main.go b/bench_server/main.go index 6c7cd82..b4743ea 100644 --- a/bench_server/main.go +++ b/bench_server/main.go @@ -6,7 +6,6 @@ import ( "math/rand" "net/http" "strconv" - "time" "github.com/valyala/fasthttp" ) @@ -15,7 +14,6 @@ var serverPort = flag.Int("p", 8080, "port to use for benchmarks") func main() { flag.Parse() - rand.Seed(time.Now().UnixNano()) addr := "localhost:" + strconv.Itoa(*serverPort) log.Println("Starting HTTP server on:", addr) log.Fatalln(fasthttp.ListenAndServe(addr, func(c *fasthttp.RequestCtx) { diff --git a/print.go b/print.go index f53747c..4bad2db 100644 --- a/print.go +++ b/print.go @@ -4,8 +4,6 @@ import ( "bytes" "encoding/json" "fmt" - "github.com/mattn/go-isatty" - "github.com/mattn/go-runewidth" "math" "os" "regexp" @@ -13,6 +11,9 @@ import ( "strconv" "strings" "time" + + "github.com/mattn/go-isatty" + "github.com/mattn/go-runewidth" ) var ( @@ -192,7 +193,7 @@ func formatFloat64(f float64) string { return strconv.FormatFloat(f, 'f', -1, 64) } -func (p *Printer) formatJSONReports(writer *bytes.Buffer, snapshot *SnapshotReport, isFinal bool, useSeconds bool) { +func (p *Printer) formatJSONReports(writer *bytes.Buffer, snapshot *SnapshotReport, _ bool, useSeconds bool) { indent := 0 writer.WriteString("{\n") indent++ diff --git a/requester.go b/requester.go index c423afe..6790b93 100644 --- a/requester.go +++ b/requester.go @@ -4,11 +4,7 @@ import ( "context" "crypto/tls" "fmt" - "github.com/valyala/fasthttp" - "github.com/valyala/fasthttp/fasthttpproxy" - "go.uber.org/automaxprocs/maxprocs" - "golang.org/x/time/rate" - "io/ioutil" + "io" "net" url2 "net/url" "os" @@ -19,6 +15,11 @@ import ( "sync/atomic" "syscall" "time" + + "github.com/valyala/fasthttp" + "github.com/valyala/fasthttp/fasthttpproxy" + "go.uber.org/automaxprocs/maxprocs" + "golang.org/x/time/rate" ) var ( @@ -259,7 +260,7 @@ func (r *Requester) DoRequest(req *fasthttp.Request, resp *fasthttp.Response, rr rr.error = err.Error() return } - err = resp.BodyWriteTo(ioutil.Discard) + err = resp.BodyWriteTo(io.Discard) if err != nil { rr.cost = time.Since(startTime) - t1 rr.error = err.Error()