Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Unified Diff: impl/memory/datastore.go

Issue 1916463004: impl/memory: Disallow empty namespace. (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/gae@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: impl/memory/datastore.go
diff --git a/impl/memory/datastore.go b/impl/memory/datastore.go
index 8001295d74ea8e7e570bcafd3b8b049c3cc0c3e2..24cc55bc9ac37aef98f463ca77faa7e3b436a336 100644
--- a/impl/memory/datastore.go
+++ b/impl/memory/datastore.go
@@ -54,10 +54,13 @@ func useRDS(c context.Context) context.Context {
// These settings can of course be changed by using the Testable() interface.
func NewDatastore(aid, ns string) (ds.Interface, error) {
ctx := UseWithAppID(context.Background(), aid)
- ctx, err := info.Get(ctx).Namespace(ns)
- if err != nil {
- return nil, err
+ if ns != "" {
+ var err error
+ if ctx, err = info.Get(ctx).Namespace(ns); err != nil {
+ return nil, err
+ }
}
+
ret := ds.Get(ctx)
t := ret.Testable()
t.AutoIndex(true)

Powered by Google App Engine
This is Rietveld 408576698