зеркало из https://github.com/golang/appengine.git
aefix: Update code using taskqueue.QueueStats.
Also drop the suggestion to use sed from the README. Anyone desiring automation should use aefix instead. Change-Id: I296056ce27400372751783db88e1a2eab102be5a
This commit is contained in:
Родитель
84098354bd
Коммит
0f8c70efe6
|
@ -44,12 +44,6 @@ See https://cloud.google.com/appengine/docs/go/modules/#Go_Instance_scaling_and_
|
|||
The import paths for App Engine packages are now fully qualified, based at `google.golang.org/appengine`.
|
||||
You will need to update your code to use import paths starting with that; for instance,
|
||||
code importing `appengine/datastore` will now need to import `google.golang.org/appengine/datastore`.
|
||||
You can do that manually, or by running this command to recursively update all Go source files in the current directory:
|
||||
(may require GNU sed)
|
||||
```
|
||||
sed -i '/"appengine/{s,"appengine,"google.golang.org/appengine,;s,appengine_,appengine/,}' \
|
||||
$(find . -name '*.go')
|
||||
```
|
||||
|
||||
### 3. Update code using deprecated, removed or modified APIs
|
||||
|
||||
|
|
|
@ -116,6 +116,11 @@ func aeFn(f *ast.File) bool {
|
|||
fixed = true
|
||||
return
|
||||
}
|
||||
if isPkgDot(call.Fun, "taskqueue", "QueueStats") && len(call.Args) == 3 {
|
||||
call.Args = call.Args[:2] // drop last arg
|
||||
fixed = true
|
||||
return
|
||||
}
|
||||
|
||||
sel, ok := call.Fun.(*ast.SelectorExpr)
|
||||
if !ok {
|
||||
|
|
|
@ -82,6 +82,35 @@ import (
|
|||
func LogSomething(c2 context.Context) {
|
||||
log.Warningf(c2, "Stand back! I'm going to try science!")
|
||||
}
|
||||
`,
|
||||
},
|
||||
|
||||
// Less widely used API changes:
|
||||
// - drop maxTasks arg to taskqueue.QueueStats
|
||||
{
|
||||
Name: "ae.2",
|
||||
In: `package foo
|
||||
|
||||
import (
|
||||
"appengine"
|
||||
"appengine/taskqueue"
|
||||
)
|
||||
|
||||
func f(ctx appengine.Context) {
|
||||
stats, err := taskqueue.QueueStats(ctx, []string{"one", "two"}, 0)
|
||||
}
|
||||
`,
|
||||
Out: `package foo
|
||||
|
||||
import (
|
||||
"golang.org/x/net/context"
|
||||
"google.golang.org/appengine"
|
||||
"google.golang.org/appengine/taskqueue"
|
||||
)
|
||||
|
||||
func f(ctx context.Context) {
|
||||
stats, err := taskqueue.QueueStats(ctx, []string{"one", "two"})
|
||||
}
|
||||
`,
|
||||
},
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче