Reputation: 885
When developing a small Google Cloud Function in Go. I noticed it will throw an error if you have everything in your package main
- eg. import "<whatever>" is a program, not an importable package
So the solution is switch it out to its own package, then deploy. If something goes wrong, throw it back into a package main and work on it locally, then switch it back.
Is this the best workflow? The other option i see is possibly making the Cloud Function its own module and importing it into a main.go file.
Upvotes: 5
Views: 1607
Reputation: 21
I was able to create a cli
folder in project's top level and then put main.go
file using package main
and main()
function inside it. That allowed me to have separate file cloud_functions.go
in root with different package name that has one or more google cloud functions in it.
Upvotes: 2