title: Error when trying to deploy Google cloud function in Go 1.11 using go modules
body: <p>I am having issues trying to deploy a Google cloud function in Go 1.11 using Go modules. I have have the following code structure in my <code>GOPATH</code>:</p>
  
  <pre><code>└── example
      ├── models
      │   ├── go.mod
      │   └── models.go
      └── load
          ├── fn.go
          ├── go.mod
          ├── go.sum
          └── vendor
              └── ....
  </code></pre>
  
  <p>the load/go.mod looks like the following:</p>
  
  <pre><code>module github.com/example/load
  
  require (
      github.com/example/models v0.0.0
  )
  
  replace github.com/example/models =&gt; ../models
  </code></pre>
  
  <p>When I try to deploy the function using the command</p>
  
  <pre class="lang-sh prettyprint-override"><code>gcloud functions deploy load-data --entry-point GCSNewFileTrigger --runtime go111 --trigger-resource new_data --trigger-event google.storage.object.finalize
  </code></pre>
  
  <p>I get the following error:</p>
  
  <pre><code>Deploying function (may take a while - up to 2 minutes)...failed.                                                                                                                                                                     
  ERROR: (gcloud.functions.deploy) OperationError: code=3, message=Build failed: go: parsing /models/go.mod: open /models/go.mod: no such file or directory
  go: error loading module requirements
  </code></pre>
  
  <p>The commands <code>go mod vendor</code> and <code>go mod verify</code> run successfully locally and I can see my local package <code>models</code> in the vendor folder of <code>load</code></p>