MCPcopy
hub / github.com/golang/protobuf / GenerateFile

Function GenerateFile

internal/gengogrpc/grpc.go:26–38  ·  view source on GitHub ↗

GenerateFile generates a _grpc.pb.go file containing gRPC service definitions.

(gen *protogen.Plugin, file *protogen.File)

Source from the content-addressed store, hash-verified

24
25// GenerateFile generates a _grpc.pb.go file containing gRPC service definitions.
26func GenerateFile(gen *protogen.Plugin, file *protogen.File) *protogen.GeneratedFile {
27 if len(file.Services) == 0 {
28 return nil
29 }
30 filename := file.GeneratedFilenamePrefix + "_grpc.pb.go"
31 g := gen.NewGeneratedFile(filename, file.GoImportPath)
32 g.P("// Code generated by protoc-gen-go-grpc. DO NOT EDIT.")
33 g.P()
34 g.P("package ", file.GoPackageName)
35 g.P()
36 GenerateFileContent(gen, file, g)
37 return g
38}
39
40// GenerateFileContent generates the gRPC service definitions, excluding the package statement.
41func GenerateFileContent(gen *protogen.Plugin, file *protogen.File, g *protogen.GeneratedFile) {

Callers

nothing calls this directly

Calls 2

GenerateFileContentFunction · 0.85
PMethod · 0.45

Tested by

no test coverage detected