无法将Go app错误422部署到AppEngine

Suddenly can't deploy Go app to GAE. Haven't changed any of the code and Works fine on local.

03:39 PM Error 422: --- begin server output --- Compile failed: 2016/10/14 12:39:46 go-app-builder: Failed parsing input: package main must be the top-level package --- end server output ---

Since it's a cloud app I don't have a Main package - everything was fine a few days ago. I'm on Windows 10 and got and update a few days ago...
I did update to the latest Go Cloud SDK but get the same error.

Do you have any non-imported subdirectories in your app directory that may contain package main? I've jumped to the conclusion that go-app-builder is applying the equivalent of go tool vet ./... (instead of go tool vet .) and is using an old version. I recently started encountering this error while deploying:

01:05 PM Error 422: --- begin server output ---
Compile failed:
2016/10/19 10:05:23 go-app-builder: Failed parsing input (2 errors)
2016/10/19 10:05:23 appleasn1.go:16:25: composite struct literal encoding/asn1.ObjectIdentifier with unkeyed fields
2016/10/19 10:05:23 appleasn1.go:17:25: composite struct literal encoding/asn1.ObjectIdentifier with unkeyed fields
--- end server output ---
01:05 PM Rolling back the update.

asn1.ObjectIdentifier is an alias for []int, so this is not a composite struct literal. This bug in vet was fixed six months ago. I shared my findings with GCloud Support, and they've assured me they're on it. As a workaround, I've made my code pass the overly strict go vet process. If you have a subdirectory in your app that contains package main, you can exclude it in your app.yaml with a skip_files directive:

skip_files:
- bench/.*
- testdata/.*

The fix for the composite error involved changing from this:

oidData = asn1.ObjectIdentifier{1, 2, 840, 113549, 1, 7, 1}

to this:

oidData = asn1.ObjectIdentifier([]int{1, 2, 840, 113549, 1, 7, 1})

EDITED:

This issue stems from App Engine Standard's new ability for apps to provide their own main package with a main function, as explained in our public Google Groups post. The workaround is to add nobuild_files: commands/.* to your 'app.yaml'. The official fix for this will be release in the next SDK 1.9.47.

In the meantime, if you have a 'main.go' file, ensure that it is in the same directory level from where you are deploying (aka the top-level package). Also ensure that you are providing the required appengine.Main() within your main function as explained in the source code.

I also recommend adding in // +build !appengine at the top of your 'main.go' as shown in the helloworld example. This will tell App Engine to skip trying to upload or compile any unused code, which may also be the cause of the deployment failure.