I work at Google on Go and Google Cloud Functions.
I see a few options for using Cloud Functions:
- Publish the generated code publicly. You may not want to do this for a variety of reasons.
- Copy the generated code into your source directory. This is the easiest. When you deploy your function, the current directory gets zipped up and sent to be built. We don't copy any dependencies from outside your current directory. If you do this, you can import the generated code by having the package path be prefixed by the module path of your directory.
- Use vendoring. If you run
go mod vendorand have that grab your generated code (at whatever path you choose), it will create a
vendordirectory with all of your dependencies. The Cloud Functions builder prefers
vendor, though. So you would have to
go.sumfile to make sure they don't get uploaded when you deploy your code. https://cloud.google.com/functions/docs/writing/specifying-dependencies-go has more information.