Skip to content

Commit 86fb177

Browse files
authored
fix(internal/librarian/golang): do not add transport in gapic options (#4155)
Do not add transport in gapic options for Go clients. Some libraries, e.g., `apigeeconnect`, `apigeeregistry` and `beyondcorp` do not have transport in gapic options. For #3617
1 parent 5546c73 commit 86fb177

4 files changed

Lines changed: 29 additions & 1 deletion

File tree

internal/librarian/golang/generate.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,9 @@ func buildGAPICOpts(apiPath string, library *config.Library, goAPI *config.GoAPI
203203
// TODO(https://github.com/googleapis/librarian/issues/3775): assuming
204204
// transport is library-wide for now, until we have figured out the config
205205
// for transports.
206-
opts = append(opts, "transport="+transport(sc))
206+
if trans := transport(sc); trans != "" {
207+
opts = append(opts, "transport="+trans)
208+
}
207209
level, err := releaseLevel(apiPath, library.Version)
208210
if err != nil {
209211
return nil, err

internal/librarian/golang/generate_test.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -838,6 +838,23 @@ func TestBuildGAPICOpts_Success(t *testing.T) {
838838
"release-level=ga",
839839
},
840840
},
841+
{
842+
name: "no transport",
843+
apiPath: "google/cloud/apigeeconnect/v1",
844+
library: &config.Library{
845+
Name: "apigeeconnect",
846+
Version: "1.2.3",
847+
APIs: []*config.API{{Path: "google/cloud/apigeeconnect/v1"}},
848+
},
849+
googleapisDir: googleapisDir,
850+
want: []string{
851+
"go-gapic-package=cloud.google.com/go/apigeeconnect/apiv1;apigeeconnect",
852+
"metadata",
853+
"rest-numeric-enums",
854+
"api-service-config=" + filepath.Join(googleapisDir, "google/cloud/apigeeconnect/v1/apigeeconnect_1.yaml"),
855+
"release-level=ga",
856+
},
857+
},
841858
} {
842859
t.Run(test.name, func(t *testing.T) {
843860
t.Parallel()

internal/serviceconfig/sdk.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@
212212
- path: google/cloud/apigeeconnect/v1
213213
transports:
214214
csharp: grpc+rest
215+
go: ""
215216
java: grpc+rest
216217
nodejs: grpc+rest
217218
php: grpc+rest
@@ -223,6 +224,7 @@
223224
path: google/cloud/apigeeregistry/v1
224225
transports:
225226
csharp: grpc+rest
227+
go: ""
226228
java: grpc+rest
227229
nodejs: grpc+rest
228230
php: grpc+rest
@@ -290,6 +292,7 @@
290292
- path: google/cloud/beyondcorp/appconnections/v1
291293
transports:
292294
csharp: grpc
295+
go: ""
293296
java: grpc
294297
nodejs: grpc+rest
295298
php: grpc+rest
@@ -298,6 +301,7 @@
298301
- path: google/cloud/beyondcorp/appconnectors/v1
299302
transports:
300303
csharp: grpc
304+
go: ""
301305
java: grpc
302306
nodejs: grpc+rest
303307
php: grpc+rest
@@ -306,6 +310,7 @@
306310
- path: google/cloud/beyondcorp/appgateways/v1
307311
transports:
308312
csharp: grpc
313+
go: ""
309314
java: grpc
310315
nodejs: grpc+rest
311316
php: grpc+rest
@@ -314,6 +319,7 @@
314319
- path: google/cloud/beyondcorp/clientconnectorservices/v1
315320
transports:
316321
csharp: grpc
322+
go: ""
317323
java: grpc
318324
nodejs: grpc+rest
319325
php: grpc+rest
@@ -322,6 +328,7 @@
322328
- path: google/cloud/beyondcorp/clientgateways/v1
323329
transports:
324330
csharp: grpc
331+
go: ""
325332
java: grpc
326333
nodejs: grpc+rest
327334
php: grpc+rest
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
type: google.api.Service
2+
name: apigeeconnect.googleapis.com

0 commit comments

Comments
 (0)