Notice: Over the next few months, we're reorganizing the App Engine documentation site to make it easier to find content and better align with the rest of Google Cloud products. The same content will be available, but the navigation will now match the rest of the Cloud products. If you have feedback or questions as you navigate the site, click Send Feedback.

The Go Runtime

Stay organized with collections Save and categorize content based on your preferences.

Overview

The Go runtime in the flexible environment is the software stack responsible for building and running your code.

To choose the Go runtime in the flexible environment, add two lines to your app.yaml file.

runtime: go
env: flex

Runtimes in the flexible environment are built using Docker. The source code for the Go runtime is available on GitHub.

Choosing a Go version

The Go runtime supports these versions:

  • 1.15
  • 1.14
  • 1.13
  • 1.12
  • 1.11 (default)
  • 1.10
  • 1.9

Developers can choose a specific Go version with go1.x format in app.yaml config file. If no version is specified, the default version of go1.11 will be automatically selected.

Your app uses the latest stable release of the version that is specified in your app.yaml file. App Engine automatically updates to new patch revisions, but will not automatically update the major version.

For example, your application might be deployed at Go 1.14.10 and later automatically updated to Go 1.14.11, but it will not be automatically updated to the major version Go 1.15.

Choosing the go runtime version go1.13 as shown below in app.yaml results in the latest version of 1.13 available, for example, 1.13.8.

  runtime: go1.13
  env: flex

Importing packages

Your code is compiled when you deploy your app to App Engine. When you run the deployment command, your app's dependencies are first collected from your local GOPATH and then they are all sent to the build server. Any missing dependencies, for example third-party libraries, results in build failures.

To avoid build failures and ensure that all your app's dependencies get deployed with your code, you should test your app locally before deploying it.

Extending the runtime

For instructions on how to extend and customize the Go runtime, read the Go runtime builder on GitHub.

Metadata server

Each instance of your application can use the Compute Engine metadata server to query information about the instance, including its host name, external IP address, instance ID, custom metadata, and service account information. App Engine does not allow you to set custom metadata for each instance, but you can set project-wide custom metadata and read it from your App Engine and Compute Engine instances.

Use the cloud.google.com/go/compute/metadata package to access the metadata server.