Apps that run in the Go 1.12+ standard runtime can use any linux/amd64-compatible package.
Using Go modules
When you deploy your app, App Engine uses the
go build command to
build your app and therefore matches the behavior of Go itself. To ensure that
your app uses module-aware mode, do the following in your development
Create your module's
go.modfile in the same directory as your
app.yamlfile. App Engine searches the current directory, then successive parent directories until it finds a
If App Engine doesn't find a
go.modfile, it follows GOPATH mode.
If you set the
GO111MODULEenvironment variable, make sure the variable's value enables module-aware mode. When you deploy your app, App Engine checks your environment for
GO111MODULEand matches the behavior of Go itself.
$GOPATH/src. If your Go 1.12 app is anywhere in the
$GOPATH/srcdirectory tree, App Engine follows GOPATH mode even if you've defined a
go.modfile for your app.
In Go 1.13 and newer, App Engine uses
module-aware mode by default,
GO111MODULE overrides the default or a
go.mod file does not exist
in the app's directory.
Vendoring copies the packages your app uses into the application directory
instead of downloading modules from their sources during the build process. Go
go build command to
vendor the packages your app needs into a directory named
vendor in your app's
In Go 1.14, if your app's root directory contains a directory named
go build command (and therefore the App Engine
deployment process) will use the packages in the vendor directory instead of
In Go 1.13 and earlier, vendoring is only available if you set up your environment to use GOPATH mode.
Using private dependencies
App Engine cannot download your private dependencies during the build process, so you must include them with your application code upon deployment.
You will need to use the
replace directive in your
go.mod file to declare
private dependencies. The following example assumes your app is in the
Change to your app directory:
Create a directory containing your private dependencies:
Make sure your private dependency is in the
privatedirectory. One approach is by creating a symlink:
mkdir private/private.example.com ln -s /path/to/private.example.com/foo private/private.example.com/foo
go.modfile to use the
replacedirective to use the
privatedirectory for your dependency:
go mod edit -replace=private.example.com/foo=./private/private.example.com/foo
go.modfile should now look like:
module private.example.com/myapp require private.example.com/foo v1.2.3 replace private.example.com/foo => ./private/private.example.com/foo
module private.example.com/myapp require private.example.com/foo v1.2.3
Do not modify how you import and use your private package. Your
importstatement should look like:
Include your private dependency in your deployment by deploying your app:
gcloud app deploy