英文:
appengine cloud storage compile error in demo project
问题
根据您提供的内容,以下是翻译的结果:
根据https://cloud.google.com/appengine/docs/go/googlecloudstorageclient/getstarted的指南进行部署时出现错误。
使用以下命令进行部署:
goapp deploy -oauth
错误信息如下:
app.go:78: cannot use google.AppEngineContext(c) (type "golang.org/x/oauth2".Option) as type "github.com/golang/oauth2".Option in function argument
通过修改google.golang.org/cloud/examples/storage/appengine/app.go
文件中第33-34行的导入语句,我成功运行了演示项目。将其修改为:
"golang.org/x/oauth2"
"golang.org/x/oauth2/google"
最重要的是,这样修改是否正确(Google是否应该更新演示项目)?如果有人了解情况,能否提供一些背景信息,解释为什么有多种方式引用同一个包(至少在我看来是这样)?谢谢!
英文:
Following https://cloud.google.com/appengine/docs/go/googlecloudstorageclient/getstarted
fails when deploying
<code>goapp deploy -oauth</code>
with
app.go:78: cannot use google.AppEngineContext(c) (type "golang.org/x/oauth2".Option) as type "github.com/golang/oauth2".Option in function argument
I'm able to get the demo project to run by altering the import lines 33-34 in google.golang.org/cloud/examples/storage/appengine/app.go
from
<code>"github.com/golang/oauth2"
"github.com/golang/oauth2/google"</code>
to
<code>"golang.org/x/oauth2"
"golang.org/x/oauth2/google"</code>
Most importantly, is this the right way to "fix" this (and should the demo project be / or have been updated by google?)
And if anyone has insight, if you could provide some context as to why there are (as it appears to me) multiple ways to refer to the same package that would be great as well.
答案1
得分: 2
是的,go子仓库已经迁移到golang.org/x/...
。
请查看公告:https://groups.google.com/forum/#!msg/golang-nuts/eD8dh3T9yyA/l5Ail-xfMiAJ
在Go 1.4中将解决确定规范导入路径的问题:https://docs.google.com/document/d/1jVFkZTcYbNLaTxXD9OcGfn7vYv5hWtPx9--lTx1gPMs
看起来示例确实存在问题。oauth库在最近的提交中引用了golang.org/x/...
路径(commit)。
英文:
Yes, the go subrepositories have been moved to golang.org/x/...
See the announcement: https://groups.google.com/forum/#!msg/golang-nuts/eD8dh3T9yyA/l5Ail-xfMiAJ
The problem with identifying the canonical import path will be addressed in Go 1.4: https://docs.google.com/document/d/1jVFkZTcYbNLaTxXD9OcGfn7vYv5hWtPx9--lTx1gPMs
It seems there is indeed a problem with the examples. The oauth library refers to the golang.org/x/...
paths with the recent commit.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论