At the build stage, Cloud Functions automatically installs dependencies necessary for a function to run. This is done when creating a new function version.
Cloud Functions supports two ways to automatically manage dependencies: using modules and the
Modules are built-in dependency management mechanisms for the
Go programming language. This is the main and recommended way to manage dependencies in Cloud Functions.
To install dependencies using modules, import the
go.mod file together with the function source code. This installs the latest versions of the packages specified in this file. To explicitly specify the versions, you should also import the
Dep is the dependency management system for
To install dependencies using the
dep utility, import the
Gopkg.lock files together with the function source code. In this case, the
dep ensure command is run just before the code is built.
If you have both the
Gopkg.toml files, builder performance isn't guaranteed. We don't recommend using these two files at the same time.
The process of installing dependencies has resource and execution time limits. For more information, see Quotas and limits. You can view the dependency installation log using the link that appears in the list of operations.