Skip to content

Commit 5229d13

Browse files
committed
Fix lint
1 parent a762b80 commit 5229d13

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

gosh.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ func (sh *StatisticsHandler) MeasureRuntime() Statistics {
113113
}
114114

115115
gcPause := make([]float64, gcCount)
116-
for i := 0; i < gcCount; i++ {
116+
for i := range gcCount {
117117
gcPause[i] = time.Duration(ms.PauseNs[(int(ms.NumGC)-i+math.MaxUint8)%gcCountThreshold]).Seconds()
118118
}
119119

gosh_test.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ func TestStatisticsHandler_ServeHTTP(t *testing.T) {
5959
srv := httptest.NewServer(h)
6060
defer srv.Close()
6161

62-
req, err := http.NewRequestWithContext(context.Background(), http.MethodGet, srv.URL, nil)
62+
req, err := http.NewRequestWithContext(t.Context(), http.MethodGet, srv.URL, nil)
6363
if err != nil {
6464
t.Fatal("failed to generate request")
6565
}
@@ -88,7 +88,7 @@ func TestStatisticsHandler_ServeHTTPWithError(t *testing.T) {
8888
srv := httptest.NewServer(h)
8989
defer srv.Close()
9090

91-
req, err := http.NewRequestWithContext(context.Background(), http.MethodGet, srv.URL, nil)
91+
req, err := http.NewRequestWithContext(t.Context(), http.MethodGet, srv.URL, nil)
9292
if err != nil {
9393
t.Fatal("failed to generate request")
9494
}
@@ -146,7 +146,7 @@ func TestStatisticsHandler_MeasureRuntimeWithGC(t *testing.T) {
146146
t.Fatal(err)
147147
}
148148

149-
for i := 0; i < 256; i++ {
149+
for range 256 {
150150
runtime.GC()
151151
}
152152

@@ -176,7 +176,7 @@ func BenchmarkStatisticsHandler_MeasureRuntime(b *testing.B) {
176176
b.ReportAllocs()
177177
b.ResetTimer()
178178

179-
for i := 0; i < b.N; i++ {
179+
for range b.N {
180180
hh.MeasureRuntime()
181181
}
182182
}

0 commit comments

Comments
 (0)