Skip to content

Commit

Permalink
chore: refactor project ID setup
Browse files Browse the repository at this point in the history
align the code to the way project ID is set in other languages.
use "official" env variable name.
  • Loading branch information
minherz committed Sep 14, 2023
1 parent d125e27 commit 1b93005
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions errorreporting/errorreporting_quickstart/main.go
Expand Up @@ -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",
Expand Down

0 comments on commit 1b93005

Please sign in to comment.