Documentation
¶
Index ¶
Constants ¶
const ( MAJOR_VERSION = 3 MINOR_VERSION = 6 REVISION_VERSION = 0 )
Variables ¶
This section is empty.
Functions ¶
func GetFileOption ¶
func GetFileOption(fd *desc.FileDescriptor, option string) (val string, err error)
func Protoc ¶
func Protoc(fd *descriptor.FileDescriptor, protodirs []string, protofile, outputdir string, pbpkgMapping map[string]string) error
Protoc process `protofile` to generate *.pb.go.
Please note protoc whose version is less than 3.6.0 has bug:
File does not reside within any path specified using --proto_path (or -I). You must specify a --proto_path which encompasses this file. Note that the proto_path must be an exact prefix of the .proto file names -- protoc is too dumb to figure out when two paths (e.g. absolute and relative) are equivalent (it's harder than you think).
当指定如下选项时,protoc仍然无法处理,这其实是个明显的bug,protoc v3.6.0+及以上版本都可以正常执行: protoc --proto_path=/root/test --go_out=paths=source_relative:/root/test/greeter/rpc greeter.proto or protoc --proto_path=. --go_out=paths=source_relative:/root/test/greeter/rpc greeter.proto
下面存在一些"排除--proto_path为当前路径的操作",纯粹是为了兼容老的protoc处理相对路径、绝对路径的bug
Types ¶
This section is empty.