这可能有点晚了,但我还没有找到一个很好的例子来让人们开始。
在开始之前,请确保您
  安装 golang 1.5
  
  安装谷歌云 SDK(cloud.google.com/sdk - 这将允许本地开发)
  
  在您的 google appengine / 云控制台中创建一个服务帐户并下载 json(API 和 auth > Credentials)
一旦以上设置:
  为您之前下载的安全凭证设置路径
  
  导出 GOOGLE_APPLICATION_CREDENTIALS=~/DIRECTORY/CREDENTIALS.json
现在您可以使用 go 进行身份验证。
package main
import (
  "fmt"
  "golang.org/x/net/context"
  "golang.org/x/oauth2/google"
   analytics "google.golang.org/api/analytics/v3"
)
var (
  scope = analytics.AnalyticsReadonlyScope 
)
func main() {
  // Authentication is provided by the gcloud tool when running locally, and
  // by the associated service account when running on Compute Engine.
  client, err := google.DefaultClient(context.Background(), scope)
  if err != nil {
        fmt.Printf("Unable to get default client: %v", err)
  }
  service, err := analytics.New(client)
  if err != nil {
        fmt.Printf("Unable to create storage service: %v", err)
  }
  fmt.Println(service)
}