From c56beb7279c6a0dd878d88e93a52786899c69eac Mon Sep 17 00:00:00 2001 From: Will McCutchen Date: Sat, 6 Sep 2025 12:01:34 -0400 Subject: [PATCH] chore: modernize The results of running go run golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@latest -fix -test ./... See [modernize analyzer docs][1] for more info. [1]: https://pkg.go.dev/golang.org/x/tools/gopls/internal/analysis/modernize --- httpbin/cmd/cmd.go | 2 +- httpbin/cmd/cmd_test.go | 2 - httpbin/digest/digest_test.go | 3 - httpbin/handlers.go | 10 ++-- httpbin/handlers_test.go | 59 +------------------- httpbin/helpers.go | 4 +- httpbin/helpers_test.go | 8 +-- httpbin/responses.go | 8 +-- httpbin/websocket/websocket_autobahn_test.go | 1 - httpbin/websocket/websocket_test.go | 1 - 10 files changed, 15 insertions(+), 83 deletions(-) diff --git a/httpbin/cmd/cmd.go b/httpbin/cmd/cmd.go index 88f49e48..d7d6dd2c 100644 --- a/httpbin/cmd/cmd.go +++ b/httpbin/cmd/cmd.go @@ -204,7 +204,7 @@ func loadConfig(args []string, getEnvVal func(string) string, getEnviron func() } // helper to generate a new ConfigError to return - configErr := func(format string, a ...interface{}) error { + configErr := func(format string, a ...any) error { return ConfigError{ Err: fmt.Errorf(format, a...), Usage: usage, diff --git a/httpbin/cmd/cmd_test.go b/httpbin/cmd/cmd_test.go index 44d4a1f5..b72ad5b2 100644 --- a/httpbin/cmd/cmd_test.go +++ b/httpbin/cmd/cmd_test.go @@ -528,7 +528,6 @@ func TestLoadConfig(t *testing.T) { } for name, tc := range testCases { - tc := tc t.Run(name, func(t *testing.T) { t.Parallel() @@ -617,7 +616,6 @@ func TestMainImpl(t *testing.T) { } for name, tc := range testCases { - tc := tc t.Run(name, func(t *testing.T) { t.Parallel() diff --git a/httpbin/digest/digest_test.go b/httpbin/digest/digest_test.go index c3ccb100..004c1e0d 100644 --- a/httpbin/digest/digest_test.go +++ b/httpbin/digest/digest_test.go @@ -118,7 +118,6 @@ func TestHash(t *testing.T) { {digestAlgorithm(10), []byte("hello, world!\n"), "910c8bc73110b0cd1bc5d2bcae782511"}, } for _, test := range tests { - test := test t.Run(fmt.Sprintf("hash/%v", test.algorithm), func(t *testing.T) { t.Parallel() result := hash(test.data, test.algorithm) @@ -180,7 +179,6 @@ func TestParseDictHeader(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.input, func(t *testing.T) { t.Parallel() results := parseDictHeader(test.input) @@ -272,7 +270,6 @@ func TestParseAuthorizationHeader(t *testing.T) { } for i, test := range tests { - test := test t.Run(fmt.Sprintf("%d", i), func(t *testing.T) { t.Parallel() got := parseAuthorizationHeader(test.input) diff --git a/httpbin/handlers.go b/httpbin/handlers.go index 36b9a595..ae9c585b 100644 --- a/httpbin/handlers.go +++ b/httpbin/handlers.go @@ -188,7 +188,7 @@ func createSpecialCases(prefix string) map[int]*statusCase { ] } `) - statusHTTP300body := []byte(fmt.Sprintf(` + statusHTTP300body := fmt.Appendf(nil, ` Multiple Choices @@ -198,15 +198,15 @@ func createSpecialCases(prefix string) map[int]*statusCase {
  • /image/png
  • /image/svg
  • -`, prefix)) +`, prefix) - statusHTTP308Body := []byte(fmt.Sprintf(` + statusHTTP308Body := fmt.Appendf(nil, ` Permanent Redirect Permanently redirected to %[1]s/image/jpeg -`, prefix)) +`, prefix) return map[int]*statusCase{ 300: { @@ -1004,7 +1004,7 @@ func (h *HTTPBin) doLinksPage(w http.ResponseWriter, _ *http.Request, n int, off w.WriteHeader(http.StatusOK) w.Write([]byte("Links")) - for i := 0; i < n; i++ { + for i := range n { if i == offset { fmt.Fprintf(w, "%d ", i) } else { diff --git a/httpbin/handlers_test.go b/httpbin/handlers_test.go index 73e71f4e..1c2c470e 100644 --- a/httpbin/handlers_test.go +++ b/httpbin/handlers_test.go @@ -98,7 +98,6 @@ func TestMain(m *testing.M) { func TestIndex(t *testing.T) { for _, env := range envs { - env := env t.Run("ok"+env.prefix, func(t *testing.T) { t.Parallel() @@ -246,7 +245,6 @@ func TestGet(t *testing.T) { {"X-Forwarded-Ssl", "on"}, } for _, test := range protoTests { - test := test t.Run(test.key, func(t *testing.T) { t.Parallel() headers := http.Header{} @@ -272,7 +270,6 @@ func TestHead(t *testing.T) { {"GET", "/head", http.StatusMethodNotAllowed}, } for _, tc := range testCases { - tc := tc t.Run(fmt.Sprintf("%s %s", tc.verb, tc.path), func(t *testing.T) { t.Parallel() @@ -378,7 +375,6 @@ func TestIP(t *testing.T) { } for name, tc := range testCases { - tc := tc t.Run(name, func(t *testing.T) { t.Parallel() @@ -512,14 +508,14 @@ func testRequestWithBody(t *testing.T, verb, path string) { // function. // // Cribbed from https://stackoverflow.com/a/70535822/151221 - getFuncName := func(f interface{}) string { + getFuncName := func(f any) string { parts := strings.Split((runtime.FuncForPC(reflect.ValueOf(f).Pointer()).Name()), ".") return parts[len(parts)-1] } // getTestName expects a function named like testRequestWithBody__BodyTooBig // and returns only the trailing BodyTooBig part. - getTestName := func(prefix string, f interface{}) string { + getTestName := func(prefix string, f any) string { name := strings.TrimPrefix(getFuncName(f), "testRequestWithBody") return fmt.Sprintf("%s/%s", prefix, name) } @@ -544,7 +540,6 @@ func testRequestWithBody(t *testing.T, verb, path string) { testRequestWithBodyTransferEncoding, } for _, testFunc := range testFuncs { - testFunc := testFunc t.Run(getTestName(verb, testFunc), func(t *testing.T) { t.Parallel() testFunc(t, verb, path) @@ -564,7 +559,6 @@ func testRequestWithBodyBinaryBody(t *testing.T, verb string, path string) { {"unknown", "encodeMe-unknown"}, } for _, test := range tests { - test := test t.Run("content type/"+test.contentType, func(t *testing.T) { t.Parallel() @@ -597,7 +591,6 @@ func testRequestWithBodyEmptyBody(t *testing.T, verb string, path string) { {"multipart/form-data; foo"}, } for _, test := range tests { - test := test t.Run("content type/"+test.contentType, func(t *testing.T) { t.Parallel() @@ -1012,7 +1005,6 @@ func testRequestWithBodyTransferEncoding(t *testing.T, verb, path string) { {"chunked", "chunked"}, } for _, tc := range testCases { - tc := tc t.Run("transfer-encoding/"+tc.given, func(t *testing.T) { t.Parallel() @@ -1073,7 +1065,6 @@ func TestStatus(t *testing.T) { } for _, test := range tests { - test := test t.Run(fmt.Sprintf("ok/status/%d", test.code), func(t *testing.T) { t.Parallel() req, _ := http.NewRequest("GET", srv.URL+fmt.Sprintf("/status/%d", test.code), nil) @@ -1101,7 +1092,6 @@ func TestStatus(t *testing.T) { } for _, test := range errorTests { - test := test t.Run("error"+test.url, func(t *testing.T) { t.Parallel() req := newTestRequest(t, "GET", test.url) @@ -1189,7 +1179,6 @@ func TestUnstable(t *testing.T) { {"/unstable?seed=1234567890&failure_rate=0.07", 200}, } for _, test := range tests { - test := test t.Run("ok_"+test.url, func(t *testing.T) { t.Parallel() req := newTestRequest(t, "GET", test.url) @@ -1204,7 +1193,6 @@ func TestUnstable(t *testing.T) { "/unstable?seed=-12345", } for _, test := range edgeCaseTests { - test := test t.Run("bad"+test, func(t *testing.T) { t.Parallel() req := newTestRequest(t, "GET", test) @@ -1226,7 +1214,6 @@ func TestUnstable(t *testing.T) { "/unstable?seed=foo", } for _, test := range badTests { - test := test t.Run("bad"+test, func(t *testing.T) { t.Parallel() req := newTestRequest(t, "GET", test) @@ -1306,7 +1293,6 @@ func TestResponseHeaders(t *testing.T) { {"text/html; charset=utf8", true}, {"text/html", true}, } { - tc := tc t.Run(tc.contentType, func(t *testing.T) { t.Parallel() @@ -1478,7 +1464,6 @@ func TestRedirectTo(t *testing.T) { } for _, test := range okTests { - test := test t.Run("ok"+test.url, func(t *testing.T) { t.Parallel() req := newTestRequest(t, "GET", test.url) @@ -1501,7 +1486,6 @@ func TestRedirectTo(t *testing.T) { {"/redirect-to?url=http%3A%2F%2Ffoo%25%25bar&status_code=418", http.StatusBadRequest}, // invalid URL } for _, test := range badTests { - test := test t.Run("bad"+test.url, func(t *testing.T) { t.Parallel() req := newTestRequest(t, "GET", test.url) @@ -1525,7 +1509,6 @@ func TestRedirectTo(t *testing.T) { {"/redirect-to?url=//evil.com", http.StatusForbidden}, // missing scheme to attempt to bypass allowlist } for _, test := range allowListTests { - test := test t.Run("allowlist"+test.url, func(t *testing.T) { t.Parallel() req := newTestRequest(t, "GET", test.url) @@ -1541,7 +1524,6 @@ func TestRedirectTo(t *testing.T) { func TestCookies(t *testing.T) { for _, env := range envs { - env := env t.Run("get"+env.prefix, func(t *testing.T) { testCases := map[string]struct { cookies cookiesResponse @@ -1564,7 +1546,6 @@ func TestCookies(t *testing.T) { } for name, tc := range testCases { - tc := tc t.Run(name, func(t *testing.T) { t.Parallel() @@ -1650,7 +1631,6 @@ func TestCookies(t *testing.T) { func TestBasicAuth(t *testing.T) { t.Run("ok", func(t *testing.T) { for _, method := range []string{"GET", "POST", "PUT", "DELETE", "PATCH"} { - method := method t.Run(method, func(t *testing.T) { t.Parallel() req := newTestRequest(t, method, "/basic-auth/user/pass") @@ -1669,7 +1649,6 @@ func TestBasicAuth(t *testing.T) { t.Run("error/no auth", func(t *testing.T) { for _, method := range []string{"GET", "POST", "PUT", "DELETE", "PATCH"} { - method := method t.Run(method, func(t *testing.T) { t.Parallel() req := newTestRequest(t, method, "/basic-auth/user/pass") @@ -1690,7 +1669,6 @@ func TestBasicAuth(t *testing.T) { t.Run("error/bad auth", func(t *testing.T) { for _, method := range []string{"GET", "POST", "PUT", "DELETE", "PATCH"} { - method := method t.Run(method, func(t *testing.T) { t.Parallel() req := newTestRequest(t, method, "/basic-auth/user/pass") @@ -1720,7 +1698,6 @@ func TestBasicAuth(t *testing.T) { {"/basic-auth/user/pass/extra", http.StatusNotFound}, } for _, test := range errorTests { - test := test t.Run("error"+test.url, func(t *testing.T) { t.Parallel() req := newTestRequest(t, "GET", test.url) @@ -1774,7 +1751,6 @@ func TestHiddenBasicAuth(t *testing.T) { {"/hidden-basic-auth/user/pass/extra", http.StatusNotFound}, } for _, test := range errorTests { - test := test t.Run("error"+test.url, func(t *testing.T) { t.Parallel() req := newTestRequest(t, "GET", test.url) @@ -1806,7 +1782,6 @@ func TestDigestAuth(t *testing.T) { {"/digest-auth/auth/user/pass/SHA-512", http.StatusBadRequest}, } for _, test := range tests { - test := test t.Run("ok"+test.url, func(t *testing.T) { t.Parallel() req := newTestRequest(t, "GET", test.url) @@ -1925,7 +1900,6 @@ func TestStream(t *testing.T) { {"/stream/-100", 1}, } for _, test := range okTests { - test := test t.Run("ok"+test.url, func(t *testing.T) { t.Parallel() @@ -1959,7 +1933,6 @@ func TestStream(t *testing.T) { } for _, test := range badTests { - test := test t.Run("bad"+test.url, func(t *testing.T) { t.Parallel() req := newTestRequest(t, "GET", test.url) @@ -1996,7 +1969,6 @@ func TestTrailers(t *testing.T) { }, } for _, tc := range testCases { - tc := tc t.Run(tc.url, func(t *testing.T) { t.Parallel() @@ -2040,7 +2012,6 @@ func TestDelay(t *testing.T) { {"/delay/1", maxDuration}, } for _, test := range okTests { - test := test t.Run("ok"+test.url, func(t *testing.T) { t.Parallel() @@ -2106,7 +2077,6 @@ func TestDelay(t *testing.T) { } for _, test := range badTests { - test := test t.Run("bad"+test.url, func(t *testing.T) { t.Parallel() req := newTestRequest(t, "GET", test.url) @@ -2154,7 +2124,6 @@ func TestDrip(t *testing.T) { {&url.Values{"duration": {"250ms"}, "delay": {"0.25s"}}, 500 * time.Millisecond, 10, http.StatusOK}, } for _, test := range okTests { - test := test t.Run(fmt.Sprintf("ok/%s", test.params.Encode()), func(t *testing.T) { t.Parallel() @@ -2337,7 +2306,6 @@ func TestDrip(t *testing.T) { {&url.Values{"duration": {"750ms"}, "delay": {"500ms"}}, http.StatusBadRequest}, } for _, test := range badTests { - test := test t.Run(fmt.Sprintf("bad/%s", test.params.Encode()), func(t *testing.T) { t.Parallel() url := "/drip?" + test.params.Encode() @@ -2559,7 +2527,6 @@ func TestRange(t *testing.T) { {"/range/26", "bytes=0-40"}, } for _, test := range badRangeTests { - test := test t.Run(fmt.Sprintf("ok_bad_range_header/%s", test.rangeHeader), func(t *testing.T) { t.Parallel() req := newTestRequest(t, "GET", test.url) @@ -2588,7 +2555,6 @@ func TestRange(t *testing.T) { } for _, test := range badTests { - test := test t.Run("bad"+test.url, func(t *testing.T) { t.Parallel() req := newTestRequest(t, "GET", test.url) @@ -2647,7 +2613,6 @@ func TestCache(t *testing.T) { {"If-Modified-Since", "my-custom-date"}, } for _, test := range tests { - test := test t.Run(fmt.Sprintf("ok_cache/%s", test.headerKey), func(t *testing.T) { t.Parallel() req := newTestRequest(t, "GET", "/cache") @@ -2680,7 +2645,6 @@ func TestCacheControl(t *testing.T) { {"/cache/3.14", http.StatusBadRequest}, } for _, test := range badTests { - test := test t.Run("bad"+test.url, func(t *testing.T) { t.Parallel() req := newTestRequest(t, "GET", test.url) @@ -2721,7 +2685,6 @@ func TestETag(t *testing.T) { {"if_match_has_no_match", "abc", "If-Match", `"xxxxxx"`, http.StatusPreconditionFailed}, } for _, test := range tests { - test := test t.Run("ok_"+test.name, func(t *testing.T) { t.Parallel() url := "/etag/" + test.etag @@ -2740,7 +2703,6 @@ func TestETag(t *testing.T) { {"/etag/foo/bar", http.StatusNotFound}, } for _, test := range badTests { - test := test t.Run(fmt.Sprintf("bad/%s", test.url), func(t *testing.T) { t.Parallel() req := newTestRequest(t, "GET", test.url) @@ -2789,7 +2751,6 @@ func TestBytes(t *testing.T) { {"/bytes/16?seed=-12345", 16}, } for _, test := range edgeCaseTests { - test := test t.Run("edge"+test.url, func(t *testing.T) { t.Parallel() @@ -2820,7 +2781,6 @@ func TestBytes(t *testing.T) { {"/bytes/16?seed=3.14", http.StatusBadRequest}, } for _, test := range badTests { - test := test t.Run("bad"+test.url, func(t *testing.T) { t.Parallel() req := newTestRequest(t, "GET", test.url) @@ -2848,7 +2808,6 @@ func TestStreamBytes(t *testing.T) { {"/stream-bytes/256?chunk_size=-10", 256}, } for _, test := range okTests { - test := test t.Run("ok"+test.url, func(t *testing.T) { t.Parallel() @@ -2877,7 +2836,6 @@ func TestStreamBytes(t *testing.T) { {"/stream-bytes/16?chunk_size=3.14", http.StatusBadRequest}, } for _, test := range badTests { - test := test t.Run("bad"+test.url, func(t *testing.T) { t.Parallel() req := newTestRequest(t, "GET", test.url) @@ -2890,7 +2848,6 @@ func TestStreamBytes(t *testing.T) { func TestLinks(t *testing.T) { for _, env := range envs { - env := env redirectTests := []struct { url string @@ -2901,7 +2858,6 @@ func TestLinks(t *testing.T) { } for _, test := range redirectTests { - test := test t.Run("ok"+env.prefix+test.url, func(t *testing.T) { t.Parallel() req := newTestRequest(t, "GET", env.prefix+test.url, env) @@ -2929,7 +2885,6 @@ func TestLinks(t *testing.T) { } for _, test := range errorTests { - test := test t.Run("error"+env.prefix+test.url, func(t *testing.T) { t.Parallel() req := newTestRequest(t, "GET", env.prefix+test.url, env) @@ -2952,7 +2907,6 @@ func TestLinks(t *testing.T) { {"/links/2/-1", `Links0 1 `}, } for _, test := range linksPageTests { - test := test t.Run("ok"+env.prefix+test.url, func(t *testing.T) { t.Parallel() req := newTestRequest(t, "GET", env.prefix+test.url, env) @@ -2986,7 +2940,6 @@ func TestImage(t *testing.T) { } for _, test := range acceptTests { - test := test t.Run("ok/accept="+test.acceptHeader, func(t *testing.T) { t.Parallel() req := newTestRequest(t, "GET", "/image") @@ -3015,7 +2968,6 @@ func TestImage(t *testing.T) { } for _, test := range imageTests { - test := test t.Run("error"+test.url, func(t *testing.T) { t.Parallel() req := newTestRequest(t, "GET", test.url) @@ -3116,7 +3068,6 @@ func TestBase64(t *testing.T) { } for _, test := range okTests { - test := test t.Run("ok"+test.requestURL, func(t *testing.T) { t.Parallel() req := newTestRequest(t, "GET", test.requestURL) @@ -3176,7 +3127,6 @@ func TestBase64(t *testing.T) { } for _, test := range errorTests { - test := test t.Run("error"+test.requestURL, func(t *testing.T) { t.Parallel() req := newTestRequest(t, "GET", test.requestURL) @@ -3251,7 +3201,6 @@ func TestBearer(t *testing.T) { }, } for _, test := range errorTests { - test := test t.Run("error"+test.authorizationHeader, func(t *testing.T) { t.Parallel() @@ -3274,7 +3223,6 @@ func TestNotImplemented(t *testing.T) { {"/brotli"}, } for _, test := range tests { - test := test t.Run(test.url, func(t *testing.T) { t.Parallel() req := newTestRequest(t, "GET", test.url) @@ -3391,7 +3339,6 @@ func TestSSE(t *testing.T) { {&url.Values{"duration": {"250ms"}, "delay": {"0.25s"}}, 500 * time.Millisecond, 10}, } for _, test := range okTests { - test := test t.Run(fmt.Sprintf("ok/%s", test.params.Encode()), func(t *testing.T) { t.Parallel() @@ -3440,7 +3387,6 @@ func TestSSE(t *testing.T) { {&url.Values{"duration": {"750ms"}, "delay": {"500ms"}}, http.StatusBadRequest}, } for _, test := range badTests { - test := test t.Run(fmt.Sprintf("bad/%s", test.params.Encode()), func(t *testing.T) { t.Parallel() url := "/sse?" + test.params.Encode() @@ -3658,7 +3604,6 @@ func TestWebSocketEcho(t *testing.T) { {fmt.Sprintf("max_fragment_size=1&max_message_size=%d", app.MaxBodySize+1), http.StatusBadRequest}, } for _, tc := range paramTests { - tc := tc t.Run(tc.query, func(t *testing.T) { t.Parallel() req := newTestRequest(t, http.MethodGet, "/websocket/echo?"+tc.query) diff --git a/httpbin/helpers.go b/httpbin/helpers.go index d1ddf97c..0c09e6e5 100644 --- a/httpbin/helpers.go +++ b/httpbin/helpers.go @@ -112,7 +112,7 @@ func writeResponse(w http.ResponseWriter, status int, contentType string, body [ w.Write(body) } -func mustMarshalJSON(w io.Writer, val interface{}) { +func mustMarshalJSON(w io.Writer, val any) { encoder := json.NewEncoder(w) encoder.SetEscapeHTML(false) encoder.SetIndent("", " ") @@ -121,7 +121,7 @@ func mustMarshalJSON(w io.Writer, val interface{}) { } } -func writeJSON(status int, w http.ResponseWriter, val interface{}) { +func writeJSON(status int, w http.ResponseWriter, val any) { w.Header().Set("Content-Type", jsonContentType) w.WriteHeader(status) mustMarshalJSON(w, val) diff --git a/httpbin/helpers_test.go b/httpbin/helpers_test.go index a56ba4ed..9272ce03 100644 --- a/httpbin/helpers_test.go +++ b/httpbin/helpers_test.go @@ -110,7 +110,6 @@ func TestParseDuration(t *testing.T) { {"-2.5", -2500 * time.Millisecond}, } for _, test := range okTests { - test := test t.Run(fmt.Sprintf("ok/%s", test.input), func(t *testing.T) { t.Parallel() result, err := parseDuration(test.input) @@ -129,7 +128,6 @@ func TestParseDuration(t *testing.T) { {"0xFF"}, } for _, test := range badTests { - test := test t.Run(fmt.Sprintf("bad/%s", test.input), func(t *testing.T) { t.Parallel() _, err := parseDuration(test.input) @@ -337,7 +335,6 @@ func TestGetClientIP(t *testing.T) { }, } for name, tc := range testCases { - tc := tc t.Run(name, func(t *testing.T) { t.Parallel() assert.Equal(t, getClientIP(tc.given), tc.want, "incorrect client ip") @@ -535,7 +532,6 @@ func TestParseWeightedChoices(t *testing.T) { } for _, tc := range testCases { - tc := tc t.Run(tc.given, func(t *testing.T) { t.Parallel() got, err := parseWeightedChoices(tc.given, strconv.Atoi) @@ -561,7 +557,6 @@ func TestWeightedRandomChoice(t *testing.T) { } for _, tc := range testCases { - tc := tc t.Run(tc, func(t *testing.T) { t.Parallel() choices, err := parseWeightedChoices(tc, func(s string) (string, error) { return s, nil }) @@ -573,7 +568,7 @@ func TestWeightedRandomChoice(t *testing.T) { t.Logf("normalized choices: %v", normalizedChoices) result := make(map[string]int, len(choices)) - for i := 0; i < 1_000; i++ { + for range 1_000 { choice := weightedRandomChoice(choices) result[choice]++ } @@ -635,7 +630,6 @@ func TestIsDangerousContentType(t *testing.T) { ",xxx", } for _, tc := range testCases { - tc := tc // baseline test t.Run(tc.contentType, func(t *testing.T) { diff --git a/httpbin/responses.go b/httpbin/responses.go index d05d525a..e280a1dc 100644 --- a/httpbin/responses.go +++ b/httpbin/responses.go @@ -51,10 +51,10 @@ type bodyResponse struct { Origin string `json:"origin"` URL string `json:"url"` - Data string `json:"data"` - Files url.Values `json:"files"` - Form url.Values `json:"form"` - JSON interface{} `json:"json"` + Data string `json:"data"` + Files url.Values `json:"files"` + Form url.Values `json:"form"` + JSON any `json:"json"` } type cookiesResponse map[string]string diff --git a/httpbin/websocket/websocket_autobahn_test.go b/httpbin/websocket/websocket_autobahn_test.go index 185df163..ee22d0fd 100644 --- a/httpbin/websocket/websocket_autobahn_test.go +++ b/httpbin/websocket/websocket_autobahn_test.go @@ -111,7 +111,6 @@ func TestWebSocketServer(t *testing.T) { for _, results := range summary { for caseName, result := range results { - result := result t.Run("autobahn/"+caseName, func(t *testing.T) { if result.Behavior == "FAILED" || result.BehaviorClose == "FAILED" { report := loadReport(t, testDir, result.ReportFile) diff --git a/httpbin/websocket/websocket_test.go b/httpbin/websocket/websocket_test.go index 0d61d6dd..fa0af475 100644 --- a/httpbin/websocket/websocket_test.go +++ b/httpbin/websocket/websocket_test.go @@ -112,7 +112,6 @@ func TestHandshake(t *testing.T) { }, } for name, tc := range testCases { - tc := tc t.Run(name, func(t *testing.T) { t.Parallel()