@@ -44,6 +44,8 @@ import (
4444
4545const epsilon = 0.001
4646
47+ type testContextKey struct {}
48+
4749// go test -run Test_Ctx_Accepts
4850func Test_Ctx_Accepts (t * testing.T ) {
4951 t .Parallel ()
@@ -3167,9 +3169,9 @@ func Test_Ctx_Context(t *testing.T) {
31673169
31683170 t .Run ("ValueContext" , func (t * testing.T ) {
31693171 t .Parallel ()
3170- testKey := struct {}{}
3172+ var testKey testContextKey
31713173 testValue := "Test Value"
3172- ctx := context .WithValue (context .Background (), testKey , testValue ) //nolint:staticcheck // not needed for tests
3174+ ctx := context .WithValue (context .Background (), testKey , testValue )
31733175 require .Equal (t , testValue , ctx .Value (testKey ))
31743176 })
31753177}
@@ -3212,17 +3214,17 @@ func Test_Ctx_SetContext(t *testing.T) {
32123214 app := New ()
32133215 c := app .AcquireCtx (& fasthttp.RequestCtx {})
32143216
3215- testKey := struct {}{}
3217+ var testKey testContextKey
32163218 testValue := "Test Value"
3217- ctx := context .WithValue (context .Background (), testKey , testValue ) //nolint:staticcheck // not needed for tests
3219+ ctx := context .WithValue (context .Background (), testKey , testValue )
32183220 c .SetContext (ctx )
32193221 require .Equal (t , testValue , c .Context ().Value (testKey ))
32203222}
32213223
32223224// go test -run Test_Ctx_Context_Multiple_Requests
32233225func Test_Ctx_Context_Multiple_Requests (t * testing.T ) {
32243226 t .Parallel ()
3225- testKey := struct {}{}
3227+ var testKey testContextKey
32263228 testValue := "foobar-value"
32273229
32283230 app := New ()
@@ -3234,7 +3236,7 @@ func Test_Ctx_Context_Multiple_Requests(t *testing.T) {
32343236 }
32353237
32363238 input := utils .CopyString (Query (c , "input" , "NO_VALUE" ))
3237- ctx = context .WithValue (ctx , testKey , fmt .Sprintf ("%s_%s" , testValue , input )) //nolint:staticcheck // not needed for tests
3239+ ctx = context .WithValue (ctx , testKey , fmt .Sprintf ("%s_%s" , testValue , input ))
32383240 c .SetContext (ctx )
32393241
32403242 return c .Status (StatusOK ).SendString (fmt .Sprintf ("resp_%s_returned" , input ))
0 commit comments