Google App Engine: request.BasicAuth undefined (type *http.Request has no field or method BasicAuth)

huangapple go评论81阅读模式
英文:

Google App Engine: request.BasicAuth undefined (type *http.Request has no field or method BasicAuth)

问题

我正在尝试将一个Go应用部署到Google App Engine,但是由于以下错误,编译失败了。

request.BasicAuth undefined (type *http.Request has no field or method BasicAuth)

我猜这个错误意味着我的Google App Engine安装不是最新的,所以我进行了更新,现在运行go_appengine/goapp version返回:

go version go1.4.1 (appengine-1.9.18) darwin/amd64

我可以成功地使用serve命令运行我的应用,但是当我尝试deploy时,仍然会出现这个错误。我漏掉了什么?

英文:

I'm trying to deploy a go app to Google App Engine but compilation is failing because of this error.

request.BasicAuth undefined (type *http.Request has no field or method BasicAuth)

I figured this error meant that my google app engine installation was not the latest one so I updated it and now running go_appengine/goapp version returns:

go version go1.4.1 (appengine-1.9.18) darwin/amd64

I can successfully serve my app but I keep getting this error when I try to deploy. What am I missing?

答案1

得分: 1

Go AppEngine运行时环境使用Go版本1.2,您可以在Go运行时环境页面上阅读到相关信息。

1.4版本的beta版运行时版本已经可用,您可以在这里了解更多信息:

go1.4beta现已准备好进行测试

如果您想使用1.4 beta运行时,您需要在app.yaml配置文件中指定如下内容:

api_version: go1.4beta

请注意,尽管Go 1.4已经发布(当前版本为1.4.2),但AppEngine运行时版本1.4仍未发布。

引用相关部分:

> Go 1.4尚未发布,因此go1.4beta运行时是基于核心Go树的release-branch.go1.4构建的,并且可能会在Go 1.4发布之前进行更新。

> 我们将不会提供Go 1.4 SDK的beta版本。您应该使用普通的Go App Engine SDK中的goapp deploy(或appcfg.py)来部署您的应用程序。

> 要使用go1.4beta,请更新您的app.yaml文件以使用新的api_version:

> api_version: go1.4beta

> 在Go 1.4发布后,它将成为api_version 'go1'的基础,而'go1.4beta'将很快被淘汰。我们预计这将在明年年初发生。

英文:

The Go AppEngine runtime environment uses Go version 1.2 as you can read it on the Go Runtime Environment page.

A beta version of 1.4 runtime version is available, you can read more about it here:

go1.4beta is now ready for testing

If you want to use the 1.4 beta runtime, you have to specify it in your app.yaml config file like this:

api_version: go1.4beta

Note that even though Go 1.4 is out (current version is 1.4.2), the AppEngine runtime version of 1.4 is still not released.

Quoting the relevant part:

> Go 1.4 has not yet been released, so the go1.4beta runtime is built
from the release-branch.go1.4 of the core Go tree, and may be updated
as Go 1.4 approaches.

> We will not be providing a beta version of the Go 1.4 SDK. You should
use goapp deploy (or appcfg.py) from the normal Go App Engine SDK to
deploy your app.

> To use go1.4beta, update your app.yaml file to use the new api_version:

> api_version: go1.4beta

> After Go 1.4 is released it will become the basis for api_version
'go1', as normal, and 'go1.4beta' will be retired soon afterward. We
expect this to happen early next year.

huangapple
  • 本文由 发表于 2015年2月21日 15:32:57
  • 转载请务必保留本文链接:https://go.coder-hub.com/28643361.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定