title: How to get project metadata using Go SDK for google cloud platform?
body: <p>I am using <a href="https://cloud.google.com/go/google.golang.org" rel="nofollow noreferrer">https://cloud.google.com/go/google.golang.org</a> API to get common instance metadata from Google Compute Engine.</p>
  
  <p>I have found an API to get metadata of a project by specifying project-id in params. Following is the code I have written:</p>
  
  <pre><code>package main
  
  import (
      "fmt"
      "golang.org/x/net/context"
      "google.golang.org/api/compute/v1"
      "golang.org/x/oauth2/google"
  )
  
  func main() {
      ctx := context.Background()
      client, err := google.DefaultClient(ctx,compute.ComputeScope)
      if err != nil {
          fmt.Println(err)
      }
      computeService, err := compute.New(client)
      projectGetCall := computeService.Projects.Get("&lt;project-id&gt;")
      project, err := projectGetCall.Do()
      fmt.Println(project)
  }
  </code></pre>
  
  <p>I am expecting it should get default credentials from GCP service account I have in my system and should print the Metadata to console. Output to console is:</p>
  
  <blockquote>
    <p>&amp;{0xc04222a150 2016-09-13T05:31:43.862-07:00 85694249451-compute@developer.gserviceaccount.com  [alpha-api] 8538061022982459200 compute#project project-id [0xc04222d310 0xc04222d360 0xc04222d3b0 0xc04222d400 0xc04222d450 0xc04222d4a0 0xc04222d540 0xc04222d590 0xc04222d5e0 0xc04222d630 0xc04222d680 0xc04222d6d0 0xc04222d720 0xc04222d770 0xc04222d7c0 0xc04222d810 0xc04222d860 0xc04222d8b0 0xc04222d900 0xc04222d950 0xc04222d9a0 0xc04222d9f0 0xc04222da40 0xc04222da90 0xc04222dae0 0xc04222db30 0xc04222db80] <a href="https://www.googleapis.com/compute/v1/projects/project-id" rel="nofollow noreferrer">https://www.googleapis.com/compute/v1/projects/project-id</a> nil UNSPECIFIED_XPN_PROJECT_STATUS {200 map[X-Content-Type-Options:[nosniff] X-Frame-Options:[SAMEORIGIN] X-Xss-Protection:[1; mode=block] Server:[GSE] Date:[Mon, 14 May 2018 06:01:39 GMT] Content-Type:[application/json; charset=UTF-8] Etag:["AZ9pASbV2zte89rFYbsuVT3-scI=/tQ5dONakPodnJi1mjg-QYom343E="] Vary:[Origin X-Origin] Alt-Svc:[hq=":443"; ma=2592000; quic=51303433; quic=51303432; quic=51303431; quic=51303339; quic=51303335,quic=":443"; ma=2592000; v="43,42,41,39,35"] Expires:[Mon, 14 May 2018 06:01:39 GMT] Cache-Control:[private, max-age=0, must-revalidate, no-transform]]} [] []}</p>
  </blockquote>
  
  <p>I don't have any experience on Go and have no idea how to extract details from this response</p>