From a38f891e3bc4e42e2cc8f54360a271793df2cc73 Mon Sep 17 00:00:00 2001 From: minherz Date: Thu, 14 Sep 2023 09:45:14 -0700 Subject: [PATCH] chore: refactor project ID setup align the code to the way project ID is set in other languages. use "official" env variable name. --- errorreporting/errorreporting_quickstart/main.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/errorreporting/errorreporting_quickstart/main.go b/errorreporting/errorreporting_quickstart/main.go index 1dfa0f1720..f1873f410f 100644 --- a/errorreporting/errorreporting_quickstart/main.go +++ b/errorreporting/errorreporting_quickstart/main.go @@ -31,14 +31,14 @@ import ( var errorClient *errorreporting.Client func main() { - ctx := context.Background() - - // TODO: Sets your Google Cloud Platform project ID via environment or explicitly - projectID := os.Getenv("GOOGLE_PROJECT_ID") - if projectID == "" { - projectID = "YOUR_PROJECT_ID" + // Set your Google Cloud Platform project ID via environment or explicitly + projectID := os.Getenv("GOOGLE_CLOUD_PROJECT") + args := os.Args[1:] + if len(args) > 0 && args[0] != "" { + projectID = args[0] } + ctx := context.Background() var err error errorClient, err = errorreporting.NewClient(ctx, projectID, errorreporting.Config{ ServiceName: "errorreporting_quickstart",