googleapis/gapic-generator-go

gapic: doc.go refers to "NewClient" instead of service-specific constructors.

timburks opened this issue · 3 comments

Reviewing this code, it appears that client constructors include the names of their associated services.

But here, a comment in generated doc.go refers to an initializer named NewClient. Is that an obsolete reference?

Not an obsolete reference, but a naive one. It should be updated to include the %s like the first link mentions.

The name that (potentially) goes in there is a reduction of the proto service name i.e. if the package is language and the proto service is named Language the factory method for that client will be NewClient (%s resolves to ""), but if the package is named language and the proto service is named FooBar, the factory method would be NewFooBarClient. This prevents stuttering like language.NewLanguageClient and language.LanguageClient.

You'll notice in your first link that the value given to the %s is something like servName - that is the reduced service name. Would happily take a fix for this, but also perhaps @quartzmo would be interested in fixing it. Either way, let us know @timburks, thanks for catching that.

Thanks @noahdietz - I'd be interested in fixing this but can't get to it for at least the next few weeks so let's leave it up for grabs. I'll follow up if/when I start any work on it.

@quartzmo any interest in making this generated doc fix?