Embedding golang context can cause stack overflows (original) (raw)

Description

In a handler:

c.SetStdContext(context.WithValue(c, "key", "red"))
c.Value("key")  // that's fine
c.Value("notkey") // stack overflow!

I don't think you should embed the context unfortunately. Too easy for this to happen.

It seems like implementations of Context really need to be immutable.