1

I've been upgrading my app engine site to go112. The go app (with package github.com/a/main.go) is using a number of sub packages in a folder called api (github.com/a/api/) and another called server. These sub packages use other dependencies.

When I run go vet, go build everything seems to be just fine.

When I deploy the app to app engine the build process fails (using Cloud Build). The output shows that a package from the api folder cannot be found. When remove the references to that package, the build fails on another package from the server folder.

The curious thing is that it my own code that cannot be found by the compilation on app engine

It is as if all of the sub packages are not being 'uploaded', but I cannot understand why.

I've run go mod init and go build ./... without any issues.

Soesah
  • 155
  • 2
  • 10
  • See [here](https://cloud.google.com/appengine/docs/standard/go112/specifying-dependencies) for changes with Go Modules. You'll need to either (continue to) use `GOPATH` or (recommended) consider migrating to Go Modules and using `go.mod`. The documentation explains how to reference dependencies correctly using both approaches. – DazWilkin Sep 29 '19 at 20:52
  • My app is both in my `GOPATH`, and I've also created a `go.mod` file. The file not being find is not technically a dependency, it's just a part of my app. – Soesah Sep 29 '19 at 21:01
  • I've removed `go.mod` but this causes every other dependency not to be found. Checkout `go env GOPATH` gives me the correct path where everything lives... – Soesah Sep 29 '19 at 21:37
  • I suggest using a `go.mod` file and moving your code to outside of your `GOPATH`. If you are trying to use a `go.mod` from within `GOPATH`, make sure you set `GO111MODULE=on`. You can create it with `go mod init github.com/a`. – jrefior Sep 29 '19 at 21:47
  • Apologies I missed your comment that you're using `go.mod`. Will try to repro. Ensure you're using absolute references in your imports; the prefix should match your `go.mod` modules path. – DazWilkin Sep 29 '19 at 22:06
  • Hmmm..... ;-) I'm able to repro. It appears (!) that your project must be in `GOPATH` even if you're using modules. I mimicked your project structure outside of `GOPATH` and observed the error but, after moving my project into `GOPATH`, deployment proceeds. – DazWilkin Sep 30 '19 at 00:14
  • The issue appears specific to Flex. For Standard, I was able to deploy outside of `GOPATH` without issue. Switching to Flex, generates the error. – DazWilkin Sep 30 '19 at 00:59
  • So I should switch to standard? I have it set to `F1` now. I was wondering if it could be related to my code being in a private repro. – Soesah Sep 30 '19 at 04:51
  • I've removed `instance_class` from `app.yaml` (to force default) but this did not work. – Soesah Sep 30 '19 at 05:07
  • Whether I move the repo to outside `GOPATH`, and with or without Flex, I still get the same error. I'll try reproducing with a smaller app, to see if I can pinpoint the issue further, but it make no sense to me whatsoever. – Soesah Sep 30 '19 at 21:34
  • Maybe the issue is the GOPATH and GOROOT configuration. I had a simillar issue and this [answer](https://stackoverflow.com/questions/7970390/what-should-be-the-values-of-gopath-and-goroot) and this [tutorial](https://golang.org/doc/install) helped me to understand how these variables need to be configured. – Andie Vanille Oct 01 '19 at 21:00

0 Answers0