I would like to fetch project-id in Go through the service account I am using in my system so that whenever that code runs on a compute instance in GCP, it should retrieve the project-id where the compute instance lies. Also if I run the code from my local machine, it should get the project-id same as "gcloud info" command gets from command line.
Does anyone have any idea which API to use in Go?