Google App Engine:request.BasicAuth未定义(类型* http.Request没有字段或方法BasicAuth)

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?

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.