我不知道如何打电话cloud.WithContext
,google.DefaultClient
如果我有appengine.Context
和没有context.Context
。
有(旧)“appengine”和(新)“google.golang.org/appengine”包。第一个自定义带来了appengine.Context
当第二个带有context.Context
从"golang.org/x/net/context"
整体google.golang.org/cloud
期待context.Context
而已。
我很乐意改用 new "google.golang.org/appengine"
,但我一直坚持使用runtime.RunInBackground
尚未移植的内容。来自https://github.com/golang/appengine:
appengine/aetest
,appengine/cloudsql
并且appengine/runtime
还没有移植。
如果appengine/runtime
已经移植,我可以写什么:
import (
"golang.org/x/net/context"
"google.golang.org/appengine"
"google.golang.org/appengine/runtime"
"google.golang.org/cloud"
"google.golang.org/cloud/storage"
)
func handler(w http.ResponseWriter, r *http.Request) {
c := appengine.NewContext(r)
runtime.RunInBackground(c, func(ctx context.Context) {
hc, _ := google.DefaultClient(ctx, storage.ScopeFullControl)
cc := cloud.WithContext(ctx, appengine.AppID(ctx), hc)
…
})
}
但还没有"google.golang.org/appengine/runtime"。所以我有
runtime.RunInBackground(c, func(ctx appengine.Context) {
杨__羊羊
相关分类