GO和VCAP_SERVICES变量

I developed a GO application for Cloud Foundry. I am trying to access/get VCAP_SERVICE variables in my GO application. No proper documentation on internet for this. In my code i am trying to access it the Java way, but returns me empty string. JDBC_URI = os.Getenv("vcap.services.postgres.credentials.jdbcUri")

I googled "VCAP_SERVICES" and the first result was documentation on the Internet:

http://docs.run.pivotal.io/devguide/deploy-apps/environment-variable.html#VCAP-SERVICES

It comes in as a JSON document, so you'll have to unmarshall the JSON and find the right data you're looking for. It's possible that some Java tools exist that let you magically reference things via ""vcap.services.postgres.credentials.jdbcUri" but in general you have to parse the JSON and access it like a normal JSON object to get what you're looking for.

I didnt something like below in my GO App to access the VCAP variables

json.Unmarshal([]byte(os.Getenv("VCAP_SERVICES")), &vcapServices)

    postgresCredentials := vcapServices["postgres"].([]interface{})[0].(map[string]interface{})["credentials"].(map[string]interface{})
    jdbcUri := postgresCredentials["jdbc_uri"].(string)