gcloud app deploy で cannot import internal package エラー

More than 1 year has passed since last update.


ERROR: ( Error Response: [9] Deployment contains files that cannot be compiled: Compile failed:
2017/12/05 23:43:37 go-app-builder: Failed parsing input: package "" cannot import internal package ""

src/cmd/go-app-builder/parser.go で以下のように import を処理している。

for path := range imports {
    pkg, ok := app.PackageIndex[path]
    if !ok {
        // A file declared an import we don't know.
        // It could be a package from the standard library.
        if findInternal(path) {
            return nil, fmt.Errorf("package %q cannot import internal package %q", p.ImportPath, path)
    p.Dependencies = append(p.Dependencies, pkg)

findInternal は以下のとおり。

func findInternal(path string) bool {
    return strings.HasSuffix(path, "/internal") ||
        strings.HasPrefix(path, "internal/") ||
        strings.Contains(path, "/internal/") ||
        path == "internal"

internal という名前だとエラーにされてしまう。