--go_out: protoc-gen-go: Plugin failed with status code 1.

1,652 阅读1分钟

本文已参与「新人创作礼」活动,一起开启掘金创作之路

更多博客见-----小生听雨园---------

更多博客见-----小生听雨园---------

见具体错误信息 proto代码如下

syntax = "proto3";

package helloworld;

message Student{
			string tag = 1;
			message Tmp{
				message Line{
					string line_name = 1;
					int32 status = 2;
					int32 ss = 3;
					int32 bb = 4;
				}
				repeated Line line=2;
			}
			Tmp tmp = 2;
}


message Person{
	Student student = 1;
}

解决办法很简单,在proto里加两行代码

package helloworld;
option go_package = "./proto;helloworld";
// option go_package = "生成位置;包名";
// 完整代码
syntax = "proto3";

package helloworld;

option go_package = "./proto;helloworld";

message Student{
			string tag = 1;
			message Tmp{
				message Line{
					string line_name = 1;
					int32 status = 2;
					int32 ss = 3;
					int32 bb = 4;
				}
				repeated Line line=2;
			}
			Tmp tmp = 2;
}

message Person{
	Student student = 1;
}

生成成功