This page describes how to install and use the bundled services with the Go runtime for App Engine standard environment. Your app can access the bundled services through the App Engine services SDK for Go.
Before you begin
- Refer to the list of legacy bundled services APIs you can call in the Go runtime.
- Before starting a migration project to Go, see the runtime migration overview and migration considerations when using legacy bundled services.
Installing the App Engine services SDK
In order to call the legacy bundled services APIs with Go, you must use the latest SDK. Follow these steps:
Update your
app.yaml
file to include the following line:app_engine_apis: true
Add a reference to the latest SDK in your
go.mod
file by runninggo get
in the terminal as follows:go get google.golang.org/appengine/v2
The main difference when upgrading to Go is using v2 of the App Engine services SDK.
In your app, modify your import statements by inserting
/v2/
in the old package names. For example, if using Memcache, do the following:import ( "google.golang.org/appengine/v2" "google.golang.org/appengine/v2/memcache" )
For the full list of available package names, see the legacy bundled services API references documentation.
Run
go mod tidy
to clean up references in yourgo.mod
file.go mod tidy
Migration considerations
You should be aware of the following considerations if you are migrating to the Go runtime and your app uses legacy bundled services:
- To test the legacy bundled services functionality in your Go app,
run your application in your local environment
with the development tools that you usually use, such as
go run
. - To deploy your app, use the
gcloud app deploy
command.