From e278a4cf36405b5989e24c6e72953169831b314d Mon Sep 17 00:00:00 2001 From: longxboy Date: Fri, 18 Jun 2021 11:49:25 +0800 Subject: [PATCH] fix protoc http cmd (#1079) --- cmd/protoc-gen-go-http/http.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 {