From fffff7f0c447dfa6ad3b74b7ef948fc1b8b78e66 Mon Sep 17 00:00:00 2001 From: Cody Oss <6331106+codyoss@users.noreply.github.com> Date: Fri, 2 Aug 2024 10:24:55 -0500 Subject: [PATCH] fix: reference gax import in storage libs (#2720) The storage client is the only client that imports gax. Depending on the RPCs being generated it may or may not use the gax import. To avoid generating an unreferenced lets always import it. --- google-api-go-generator/gen.go | 3 +++ storage/v1/storage-gen.go | 1 + 2 files changed, 4 insertions(+) diff --git a/google-api-go-generator/gen.go b/google-api-go-generator/gen.go index 06068115d9b..87be88b10df 100644 --- a/google-api-go-generator/gen.go +++ b/google-api-go-generator/gen.go @@ -858,6 +858,9 @@ func (a *API) GenerateCode() ([]byte, error) { pn("var _ = context.Canceled") pn("var _ = internaloption.WithDefaultEndpoint") pn("var _ = internal.Version") + if a.Name == "storage" { + pn("var _ = gax.Version") + } pn("") pn("const apiId = %q", a.doc.ID) pn("const apiName = %q", a.doc.Name) diff --git a/storage/v1/storage-gen.go b/storage/v1/storage-gen.go index 07de6ebf63c..27504b0aad0 100644 --- a/storage/v1/storage-gen.go +++ b/storage/v1/storage-gen.go @@ -93,6 +93,7 @@ var _ = strings.Replace var _ = context.Canceled var _ = internaloption.WithDefaultEndpoint var _ = internal.Version +var _ = gax.Version const apiId = "storage:v1" const apiName = "storage"