google-api-go-client icon indicating copy to clipboard operation
google-api-go-client copied to clipboard

Panic when generating serviceuser:v1

Open saicheems opened this issue 9 years ago • 5 comments

2017/02/10 12:41:21 Generating API serviceuser:v1
panic: Clash on name Service

See google-api-go-generator/gen.go:1050.

Seems there's a public field also named Service...

saicheems avatar Feb 10 '17 21:02 saicheems

@zombiezen, as you'll see, this panic is explicit in the code, not the result of some bug. I'm not sure how to handle it.

jba avatar Feb 10 '17 21:02 jba

Renaming the top-level Service is not an option, in my opinion, as it would potentially break all users of this library of APIs.

It might be possible to patch the serviceuser:v1 API and rename their Service struct.

I'm leaning toward temporarily black-listing the serviceuser:v1 API in order to update the other APIs.

gmlewis avatar Feb 23 '17 23:02 gmlewis

Created https://code-review.googlesource.com/#/c/11171/ as recommended by @broady.

gmlewis avatar Feb 23 '17 23:02 gmlewis

Yes, sorry, missed this bug.

Renaming the struct is the correct thing to do. Maybe the panic should reference some bug that explains what to do.

broady avatar Feb 23 '17 23:02 broady

Fixed in https://github.com/google/google-api-go-client/commit/64485db7e8c8be51e572801d06cdbcfadd3546c1 Thank you, @broady!

gmlewis avatar Feb 24 '17 00:02 gmlewis