After obtain a context from ctx, ctxErr := appengine.Namespace(ctx, "MyContext")
I would expect ctx
namespace to be populated with MyContext
Code
import (
...
"golang.org/x/net/context"
"google.golang.org/appengine"
)
ctx := appengine.NewContext(r)
ctx, ctxErr := appengine.Namespace(ctx, "MyContext")
if ctxErr != nil {
log.Errorf(ctx, "Failed to obtain custom namespace context, error:%s", ctxErr.Error())
//use default if all else fails
ctx = appengine.NewContext(r)
}
However this is not the case, thus causing all namespace aware API to use default namespace.
Dump of ctx produces the following (see yellow bordered output)
Example App
Populate projectID := ""
with your project id, ensure you have performed authentication on your development environment and run go run /example/app/main.go