English

Google App Engine

App Engine Go Overview

Welcome to Google App Engine for Go! Experimental

With App Engine, you can build web applications using the Go Programming Language. Your Go application runs on Google's scalable infrastructure and uses large-scale persistent storage and services.

If you haven't already, see the Go Getting Started Guide for an introduction to developing web applications with Go and Google App Engine.

The Go Runtime Environment

The Go SDK provides an interface similar to the standard Go http package; writing Go App Engine apps is akin to writing stand-alone Go web servers.

The Go runtime environment uses Go release r60.3. The SDK includes the Go compiler and standard library, so it has no additional dependencies. As with the Java and Python environments, not all the standard library's functionality is available inside the sandbox. For example, attempts to open a socket or write to a file will return an os.EINVAL error.

The SDK includes an automated build service to compile your app, so you'll never need to invoke the compiler yourself. And—as with the Python SDK—your app will be automatically re-built whenever you change the source.

The Go runtime environment for App Engine provides full support for goroutines, but not for parallel execution: goroutines are scheduled onto a single operating system thread. This single-thread restriction may be lifted in future versions. Multiple requests may be handled concurrently by a given instance.

Go apps run inside a secure "sandbox" environment with a reduced set of libraries. For instance, an app cannot write data to the local file system or make arbitrary network connections. Instead, apps use scalable services provided by App Engine to store data and communicate over the Internet.

See Runtime Environment for more information.

The Datastore and Services

Apps can use the App Engine Datastore for reliable, scalable persistent storage of data. The Go Datastore API provides an idiomatic means of storing and retrieving Go data structures.

The Blobstore API allows your app to store and serve data objects, called blobs, that are much larger than the size allowed for objects in the Datastore service.

The Channel API creates a persistent connection between your application and JavaScript clients, allowing it to send and receive messages in real time without the use of polling.

The App Engine Memcache provides fast, transient distributed storage for caching the results of datastore queries and calculations.

The Task Queue API allows your app to perform background processing by inserting tasks (modeled as web hooks) into a queue.

Apps use the URL Fetch service to access resources over the web, and to communicate with other hosts using the HTTP and HTTPS protocols.

An application can use Google Accounts for user authentication. The user account creation and sign-in is handled by Google Accounts, and a user that already has a Google account (such as a GMail account) can use that account with your app. An app can detect when the current user is signed in, and can access the user's email address.

Tools

The App Engine Go SDK uses the tools from the Python SDK for testing your application and uploading application files.

The development server runs your application on your local computer for testing your application. The server simulates the App Engine Datastore, services and sandbox restrictions. The development server can also generate configuration for Datastore indices based on the queries the app performs during testing.

A multipurpose tool called appcfg.py handles all command-line interaction with your application running on App Engine. The appcfg.py tool can upload your application to App Engine, or just update the datastore index configuration so you can build new indexes before updating the code. It can also download the app's log data, so you can analyze your app's performance using your own tools.

The SDK also includes some tools from the Go tool chain.

Gofix finds Go programs that use old APIs and rewrites them to use newer ones. After you update to a new App Engine SDK release, gofix helps make the necessary changes to your programs.

Godoc extracts and generates documentation for Go programs. Godoc uses the source code of the Go standard library and Go App Engine SDK that is included in the SDK zip file.

Gofmt formats Go programs.