diff --git a/cmd/protoc-gen-go-http/http.go b/cmd/protoc-gen-go-http/http.go index e6dcfdf0e..9116f706f 100644 --- a/cmd/protoc-gen-go-http/http.go +++ b/cmd/protoc-gen-go-http/http.go @@ -78,7 +78,9 @@ func genService(gen *protogen.Plugin, file *protogen.File, g *protogen.Generated sd.Methods = append(sd.Methods, buildMethodDesc(g, method, "POST", path)) } } - g.P(sd.execute()) + if len(sd.Methods) != 0 { + g.P(sd.execute()) + } } func hasHTTPRule(services []*protogen.Service) bool {