title: gcloud app deploy fails "cannot import internal package"
body: <p>I am compiling a GO app that I want to upload and run on the Google Cloud Platform. I am importing the <code>appengine/datastore</code> package and am running into problems with vendoring of the packages. Since I want to provide stable builds I want to have as much of the dependencies vendored in my source tree, but when I vendor <code>appengine/datastore</code> I run in to problems runnning <code>gcloud app deploy</code>:</p>
  
  <p>OperationError: Error Response: [9] Deployment contains files that cannot be compiled: Compile failed:
  2017/09/19 01:07:31 go-app-builder: Failed parsing input: package "vendor/google.golang.org/appengine/search" cannot import internal package "google.golang.org/appengine/internal/search"</p>
  
  <pre><code>ERROR: (gcloud.app.deploy) Error Response: [9] Deployment contains files that cannot be compiled: Compile failed:
  2017/09/19 01:07:31 go-app-builder: Failed parsing input: package "vendor/google.golang.org/appengine/search" cannot import internal package "google.golang.org/appengine/internal/search"
  </code></pre>
  
  <p>I can run the <code>dev_appserver.py</code> script just fine, the application runs smoothly locally, and <code>go test</code> succeeds compiling and running all the module tests.</p>
  
  <p>If I try to remove the vendoring of any of the appengine packages and instead use <code>go get</code> to install them outside of the version control, <code>dev_appserver.py</code> no longer runs, complaining about duplicate packages:</p>
  
  <pre><code>rm -rf ../vendor/google.golang.org/appengine
  go get google.golang.org/appengine
  dev_appserver.py app.yaml
  [....]
  2017/09/19 10:20:10 go-app-builder: Failed parsing input: package "golang.org/x/net/context" is imported from multiple locations: "/home/peter/src/myproject/go/src/myproject/vendor/golang.org/x/net/context" and "/home/peter/src/myproject/go/src/golang.org/x/net/context"
  </code></pre>
  
  <p>while <code>gcloud app deploy</code> instead complains about not finding the packages at all:</p>
  
  <pre><code>[...]
  File upload done.
  Updating service [default]...failed.                                                             
  ERROR: (gcloud.app.deploy) Error Response: [9] Deployment contains files that cannot be compiled: Compile failed:
  Compile failed:
  2017/09/19 01:22:13 go-app-builder: build timing: 7×compile (1.749s total), 0×link (0s total)
  2017/09/19 01:22:13 go-app-builder: failed running compile: exit status 2
  myproject/vendor/golang.org/x/text/unicode/norm/normalize.go:15: can't find import: "golang.org/x/text/transform"
  $ find .. -name transform
  ../vendor/golang.org/x/text/transform
  </code></pre>
  
  <p><strong>EDIT</strong>: <em>WORKAROUND</em>: I have found that I can make it compile with <code>gcloud</code> by symlinking the vendored directories (<code>github.com</code> and <code>golang.org</code>) into the application directory (<code>ln -s ../vendor/* .</code>), and downloading the appengine package manually (<code>go get google.golang.org/appengine</code>). However, I need to delete the symlinks to be able to run <code>dev_appserver.py</code>, so this is not nearly optimal.</p>