test(context): use named context key in multipart cleanup test

staticcheck SA1029 forbids empty anonymous struct as context.WithValue
keys; use a local named type instead.
This commit is contained in:
RubenPari 2026-08-09 22:38:12 +02:00
parent 2c86eae948
commit 433700d545

View File

@ -302,8 +302,10 @@ func TestServeHTTPCleansMultipartFormAfterWithContext(t *testing.T) {
router := New()
router.MaxMultipartMemory = 32 // force temp file
// Named key type required by staticcheck SA1029 (avoid empty anonymous struct keys).
type withContextMarker struct{}
router.Use(func(c *Context) {
c.Request = c.Request.WithContext(context.WithValue(c.Request.Context(), struct{}{}, 1))
c.Request = c.Request.WithContext(context.WithValue(c.Request.Context(), withContextMarker{}, 1))
c.Next()
})