appengine.Context
is an interface, so you have to use the alternative MapTo
. Also, according to the docs, mapping should be performed on the martini Context, not on the Martini object itself.
So your code should be:
m.Use(func(c martini.Context, req *http.Request) {
ctx := appengine.NewContext(req)
ctx, err := appengine.Namespace(ctx, namespace)
if err != nil {
ctx.Debugf("[Namespace] %s", err)
}
c.MapTo(ctx, (*appengine.Context)(nil))
})