init context struct

This commit is contained in:
fj.jin 2020-11-16 13:49:30 +08:00
parent 6e5017ad0f
commit 4e97c01e00

5
gin.go
View File

@ -165,7 +165,10 @@ func Default() *Engine {
func (engine *Engine) allocateContext() *Context {
v := make(Params, 0, engine.maxParams)
return &Context{engine: engine, params: &v}
c := &Context{engine: engine, params: &v}
// init context struct
c.reset()
return c
}
// Delims sets template left and right delims and returns a Engine instance.