在 Go 1.9 中,您可以使用“dev_appserver.py yaml”运行本地 GAE 模拟器
似乎 google-cloud-sdk/ 已被弃用。
Go 1.12 文档表示您可以使用“go run”在本地运行模拟器 https://cloud.google.com/appengine/docs/standard/go112/testing-and-deploying-your-app
我无法运行演示应用程序:
google.golang.org/appengine/demos/helloworld
$ 运行 *.go
2019/09/25 10:57:27 INFO: Serving the front page.
panic: Metadata fetch failed for 'instance/attributes/gae_project': Get http://metadata/computeMetadata/v1/instance/attributes/gae_project: dial tcp: lookup metadata: no such host
goroutine 5 [running]:
google.golang.org/appengine/internal.mustGetMetadata(0x1474a38, 0x1f, 0x0, 0x0, 0x0)
/Users/Steve/go/src/google.golang.org/appengine/internal/metadata.go:34 +0x18a
google.golang.org/appengine/internal.partitionlessAppID(0x0, 0xc0000304c0)
/Users/Steve/go/src/google.golang.org/appengine/internal/identity_vm.go:112 +0xa2
google.golang.org/appengine/internal.DefaultTicket.func1()
/Users/Steve/go/src/google.golang.org/appengine/internal/api.go:294 +0x86
sync.(*Once).Do(0x17f0150, 0x1484448)
/usr/local/go/src/sync/once.go:44 +0xb3
google.golang.org/appengine/internal.DefaultTicket(0xc0001945d0, 0x13b78e0)
/Users/Steve/go/src/google.golang.org/appengine/internal/api.go:289 +0x39
google.golang.org/appengine/internal.Call(0x14d9f00, 0xc0001945d0, 0x146a718, 0xa, 0x14666df, 0x5, 0x14d8ec0, 0xc0000304c0, 0x14d80c0, 0xc00000c1e0, ...)
/Users/Steve/go/src/google.golang.org/appengine/internal/api.go:496 +0x8ea
google.golang.org/appengine/internal.(*context).flushLog(0xc0001920c0, 0x1484b01, 0xc00002e100)
/Users/Steve/go/src/google.golang.org/appengine/internal/api.go:641 +0x3c7
google.golang.org/appengine/internal.handleHTTP.func1(0xc00002e120, 0xc0001920c0)
/Users/Steve/go/src/google.golang.org/appengine/internal/api.go:138 +0x56
created by google.golang.org/appengine/internal.handleHTTP
/Users/Steve/go/src/google.golang.org/appengine/internal/api.go:134 +0x350
exit status 2
我究竟做错了什么?
ABOUTYOU
12345678_0001
相关分类