Help us understand the problem. What are the problem?

More than 3 years have passed since last update.

posted at

updated at

gcloud app deploy で cannot import internal package エラー


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 という名前だとエラーにされてしまう。


Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
What you can do with signing up
Help us understand the problem. What are the problem?