问题复现:
$ protoc --go_out=./ *.proto
protoc-gen-go: unable to determine Go import path for "test.proto"
Please specify either:
• a "go_package" option in the .proto source file, or
• a "M" argument on the command line.
See https://developers.google.com/protocol-buffers/docs/reference/go-generated#package for more information.
--go_out: protoc-gen-go: Plugin failed with status code 1.
解决方法
指定包名的位置改成:
option go_package = "./";
重新执行
protoc --go_out=./ *.proto
即可