The Go Runtime


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.

Go version

Consult the GO_VERSION variable in the Dockerfile to see the version of Go used to build your application.

If the version is updated, you must re-deploy your application to build it against a new runtime.

Importing packages

Your code is compiled when you deploy your application. The remote builder expects all dependencies to be uploaded alongside your application's code, and will not call go get to fetch external dependencies.

To ensure any required dependencies are uploaded with your application code (e.g. third-party libraries), use the aedeploy tool. See the Testing and Deploying your Application page for details on installing aedeploy and using it to deploy your application.

Extending the runtime

You can extend and customize the runtime by modifying the default Dockerfile. First, generate the Dockerfile:

gcloud beta app gen-config --custom

Finally, change runtime: go in your app.yaml file:

runtime: custom

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 package to access the metadata server.

Send feedback about...

App Engine flexible environment for Go