Skip to content

Commit b62d289

Browse files
committed
fix govet
Signed-off-by: Cassandra Coyle <[email protected]>
1 parent a617360 commit b62d289

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

pkg/diagnostics/http_tracing_test.go

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ func TestHTTPTraceMiddleware(t *testing.T) {
338338

339339
// overwrite handler to ensure we check the ctx baggage properly
340340
var handlerCtx context.Context
341-
fakeHandler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
341+
fakeHandler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
342342
handlerCtx = r.Context()
343343
w.WriteHeader(http.StatusOK)
344344
})
@@ -366,7 +366,7 @@ func TestHTTPTraceMiddleware(t *testing.T) {
366366

367367
// overwrite handler to ensure we check the ctx baggage properly
368368
var handlerCtx context.Context
369-
fakeHandler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
369+
fakeHandler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
370370
handlerCtx = r.Context()
371371
w.WriteHeader(http.StatusOK)
372372
})
@@ -395,7 +395,7 @@ func TestHTTPTraceMiddleware(t *testing.T) {
395395

396396
// overwrite handler to ensure we check the ctx baggage properly
397397
var handlerCtx context.Context
398-
fakeHandler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
398+
fakeHandler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
399399
handlerCtx = r.Context()
400400
w.WriteHeader(http.StatusOK)
401401
})
@@ -421,7 +421,7 @@ func TestHTTPTraceMiddleware(t *testing.T) {
421421

422422
// overwrite handler to ensure we check the ctx baggage properly
423423
var handlerCtx context.Context
424-
fakeHandler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
424+
fakeHandler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
425425
handlerCtx = r.Context()
426426
w.WriteHeader(http.StatusOK)
427427
})
@@ -448,7 +448,7 @@ func TestHTTPTraceMiddleware(t *testing.T) {
448448

449449
// overwrite handler to ensure we check the ctx baggage properly
450450
var handlerCtx context.Context
451-
fakeHandler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
451+
fakeHandler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
452452
handlerCtx = r.Context()
453453
w.WriteHeader(http.StatusOK)
454454
})
@@ -471,7 +471,7 @@ func TestHTTPTraceMiddleware(t *testing.T) {
471471

472472
// overwrite handler to ensure we check the ctx baggage properly
473473
var handlerCtx context.Context
474-
fakeHandler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
474+
fakeHandler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
475475
handlerCtx = r.Context()
476476
w.WriteHeader(http.StatusOK)
477477
})
@@ -497,7 +497,7 @@ func TestHTTPTraceMiddleware(t *testing.T) {
497497

498498
// overwrite handler to ensure we check the ctx baggage properly
499499
var handlerCtx context.Context
500-
fakeHandler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
500+
fakeHandler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
501501
handlerCtx = r.Context()
502502
w.WriteHeader(http.StatusOK)
503503
})
@@ -539,7 +539,7 @@ func TestHTTPTraceMiddleware(t *testing.T) {
539539

540540
// overwrite handler to ensure we check the ctx baggage properly
541541
var handlerCtx context.Context
542-
fakeHandler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
542+
fakeHandler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
543543
handlerCtx = r.Context()
544544
w.WriteHeader(http.StatusOK)
545545
})
@@ -566,7 +566,7 @@ func TestHTTPTraceMiddleware(t *testing.T) {
566566

567567
// overwrite handler to ensure we check the ctx baggage properly
568568
var handlerCtx context.Context
569-
fakeHandler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
569+
fakeHandler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
570570
handlerCtx = r.Context()
571571
w.WriteHeader(http.StatusOK)
572572
})
@@ -593,8 +593,8 @@ func TestHTTPTraceMiddleware(t *testing.T) {
593593
req.Header.Add("baggage", "invalid-baggage")
594594

595595
rr := httptest.NewRecorder()
596-
fakeHandler1 := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {})
597-
handler := HTTPTraceMiddleware(fakeHandler1, "fakeAppID", config.TracingSpec{SamplingRate: "1"})
596+
fakeHandler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {})
597+
handler := HTTPTraceMiddleware(fakeHandler, "fakeAppID", config.TracingSpec{SamplingRate: "1"})
598598
handler.ServeHTTP(rr, req)
599599

600600
assert.Equal(t, http.StatusBadRequest, rr.Code)
@@ -609,8 +609,8 @@ func TestHTTPTraceMiddleware(t *testing.T) {
609609
req.Header.Add("baggage", "key1=value1,key2=value2")
610610

611611
rr := httptest.NewRecorder()
612-
fakeHandler2 := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {})
613-
handler := HTTPTraceMiddleware(fakeHandler2, "fakeAppID", config.TracingSpec{SamplingRate: "1"})
612+
fakeHandler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {})
613+
handler := HTTPTraceMiddleware(fakeHandler, "fakeAppID", config.TracingSpec{SamplingRate: "1"})
614614
handler.ServeHTTP(rr, req)
615615

616616
assert.Equal(t, "key1=value1,key2=value2", rr.Header().Get("baggage"))
@@ -626,7 +626,7 @@ func TestHTTPTraceMiddleware(t *testing.T) {
626626

627627
// overwrite handler to ensure we check the ctx baggage properly
628628
var handlerCtx context.Context
629-
fakeHandler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
629+
fakeHandler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
630630
handlerCtx = r.Context()
631631
w.WriteHeader(http.StatusOK)
632632
})
@@ -663,7 +663,7 @@ func TestHTTPTraceMiddleware(t *testing.T) {
663663

664664
// overwrite handler to ensure we check the ctx baggage properly
665665
var handlerCtx context.Context
666-
fakeHandler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
666+
fakeHandler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
667667
handlerCtx = r.Context()
668668
w.WriteHeader(http.StatusOK)
669669
})
@@ -704,7 +704,7 @@ func TestHTTPTraceMiddleware(t *testing.T) {
704704

705705
// overwrite handler to ensure we check the ctx baggage properly
706706
var handlerCtx context.Context
707-
fakeHandler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
707+
fakeHandler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
708708
handlerCtx = r.Context()
709709
w.WriteHeader(http.StatusOK)
710710
})
@@ -735,7 +735,7 @@ func TestHTTPTraceMiddleware(t *testing.T) {
735735

736736
// overwrite handler to ensure we check the ctx baggage properly
737737
var handlerCtx context.Context
738-
fakeHandler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
738+
fakeHandler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
739739
handlerCtx = r.Context()
740740
w.WriteHeader(http.StatusOK)
741741
})
@@ -767,7 +767,7 @@ func TestHTTPTraceMiddleware(t *testing.T) {
767767

768768
// overwrite handler to ensure we check the ctx baggage properly
769769
var handlerCtx context.Context
770-
fakeHandler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
770+
fakeHandler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
771771
handlerCtx = r.Context()
772772
w.WriteHeader(http.StatusOK)
773773
})

0 commit comments

Comments
 (0)