我有包含以下内容的简单原型文件。
\nsyntax="proto3";\n\npackage main;\n\nmessage Person {\n string name = 1;\n int32 age = 2; \n}\nRun Code Online (Sandbox Code Playgroud)\n我正在尝试使用 protoc 为其生成 go 代码。我跑:
\nprotoc --go_out=. simple.proto\nRun Code Online (Sandbox Code Playgroud)\n我收到以下错误:
\nprotoc-gen-go: unable to determine Go import path for "simple.proto"\n\nPlease specify either:\n \xe2\x80\xa2 a "go_package" option in the .proto source file, or\n \xe2\x80\xa2 a "M" argument on the command line.\nRun Code Online (Sandbox Code Playgroud)\nmain.go,go.mod并且simple.proto位于同一文件夹中。和protoc都protoc-gen-go在 PATH 环境中定义。