cmd/protoc-gen-go-grpc: don't emit const blocks for services with no methods (#7055)

This commit is contained in:
Conor Evans 2024-03-21 22:56:37 +00:00 committed by GitHub
parent eb5828bae7
commit a9759783ed
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 0 deletions

View File

@ -52,6 +52,10 @@ func (serviceGenerateHelper) formatFullMethodSymbol(service *protogen.Service, m
}
func (serviceGenerateHelper) genFullMethods(g *protogen.GeneratedFile, service *protogen.Service) {
if len(service.Methods) == 0 {
return
}
g.P("const (")
for _, method := range service.Methods {
fmSymbol := helper.formatFullMethodSymbol(service, method)