func altProjectSources()

in cli/cmd/state.go [66:87]


func altProjectSources() {
	Project = os.Getenv("GOOGLE_PROJECT")
	if Project != "" {
		return
	}
	cmd := exec.Command("gcloud", "config", "get-value", "core/project")
	stdout, _ := cmd.Output()
	Project = strings.TrimSuffix(string(stdout), "\n")
	if Project == "" {
		if Out == JsonO {
			err := map[string]string{"error": "GCP Project ID is not set"}
			msg, _ := json.Marshal(err)
			fmt.Println(string(msg))
		} else {
			fmt.Println("GCP Project ID is not set. Please do one of the following:")
			fmt.Println("* re-run the command with --project flag")
			fmt.Println("* set GOOGLE_PROJECT env variable")
			fmt.Println("* set the Project ID using `gcloud config set project <project-id>` command")
		}
		os.Exit(1)
	}
}