<br />

<br />


This page describes how to install and use the bundled
services with the [Go runtime](https://docs.cloud.google.com/appengine/docs/standard/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](https://docs.cloud.google.com/appengine/docs/standard/services/overview) you can call in the Go runtime.
- Before starting a migration project to Go, see the [runtime migration overview](https://docs.cloud.google.com/appengine/migration-center/standard/migrate-to-second-gen/go-differences) and [migration considerations](https://docs.cloud.google.com/appengine/docs/standard/go/services/access#migration) when using legacy bundled services.

## Installing the App Engine services SDK

To call the legacy bundled services APIs with Go, you
must use the latest SDK. Follow these steps:

1. Update your [`app.yaml`](https://docs.cloud.google.com/appengine/docs/standard/reference/app-yaml?tab=go#app_engine_bundled_services)
   file to specify one or more legacy bundled services. For example:

       app_engine_bundled_services:
       - datastore_v3
       - memcache
       - user

   If you use features such as `login: admin` in the `handlers` section of `app.yaml` file, enable the Users API by configuring the `user` setting in the `app_engine_bundled_services` list.
2. Add a reference to the latest SDK in your `go.mod` file by running `go 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.
3. 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](https://docs.cloud.google.com/appengine/docs/standard/go/reference/services/bundled/latest).
4. Run `go mod tidy` to clean up references in your `go.mod` file.

       go mod tidy

> [!NOTE]
> **Note:** When upgrading to a new major version of a Go dependency, such as a package or library, make sure to include the major version number of the dependency in your import statements. If you run `go mod tidy` and find that it is still importing an older version of the App Engine services SDK for Go, you have probably missed upgrading an import statement.

## 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](https://docs.cloud.google.com/appengine/docs/standard/testing-and-deploying-your-app#running_locally) with the development tools that you usually use, such as `go run`.
- To deploy your app, use the [`gcloud app deploy`](https://docs.cloud.google.com/appengine/docs/standard/go/building-app#deploying_your_web_service_on) command.