Open ghost opened 3 years ago
same issue!
same issue
same issue
➜ rpcEcomm protoc --version
libprotoc 3.6.1
I solved it, you need to fix the go_package inside the proto file
Initially, my .proto
file was
syntax = "proto3";
package greet;
option go_package="greetpb";
service GreetService{}
I changed the value of go_package
from "greetpb"
to "./greet/greetpb"
and it started working.
You need to change your option go_package
into
option go_package = "./;pb";
The first param means relative path where the code you want to generate. The path relative to the --go_out
, you set in your command.
you need set the path twice ,it is confused, I know....
The second is just the package name.
You need to change your
option go_package
intooption go_package = "./;pb";
The first param means relative path where the code you want to generate. The path relative to the--go_out
, you set in your command.you need set the path twice ,it is confused, I know....
The second is just the package name.
Saved my day!
You need to change your
option go_package
intooption go_package = "./;pb";
The first param means relative path where the code you want to generate. The path relative to the--go_out
, you set in your command. you need set the path twice ,it is confused, I know.... The second is just the package name.Saved my day!
Save two days ~!!!
You need to change your
option go_package
intooption go_package = "./;pb";
The first param means relative path where the code you want to generate. The path relative to the--go_out
, you set in your command.you need set the path twice ,it is confused, I know....
The second is just the package name.
That works,thank you
thanks
i dont even put my proto file inside some folder, is it has anything to do with folder if i user go_package =".folder/;pb"??
You need to change your
option go_package
intooption go_package = "./;pb";
The first param means relative path where the code you want to generate. The path relative to the--go_out
, you set in your command.you need set the path twice ,it is confused, I know....
The second is just the package name.
Thank you very much! Saved my day :)
Initially, my
.proto
file wassyntax = "proto3"; package greet; option go_package="greetpb"; service GreetService{}
I changed the value of
go_package
from"greetpb"
to"./greet/greetpb"
and it started working.
Awesome details there! Save me 1 day! Thank you!
protoc --proto_path=proto proto/*.proto --go_out=plugins=grpc:pb
good
Thank you guys, you help me a lot.
Thank you !!
I hacked proto-gen-go to fix this, and it works just fine:
I fixed it changing the go_package
value from protofiles;pb
to ./protofiles;pb
option go_package = "./protofiles;pb";
You need to change your
option go_package
intooption go_package = "./;pb";
The first param means relative path where the code you want to generate. The path relative to the--go_out
, you set in your command.you need set the path twice ,it is confused, I know....
The second is just the package name.
Thanks a lot, really saved me there!
I changed my go_package to
option go_package = "./;proto";
and this was the command I used (the folder name I used to store my proto file is proto)
protoc --proto_path=proto --go_out=proto --go_opt=paths=source_relative proto.proto
... it's way easier to just use a modified version of protoc-gen-go without the unnecessary check for a / in the package import path.
it works just fine without it.
see:
Discuss with me & other students on Tech School Discord group
incase any one wants the generated file to be in same folder with .proto just use option go_package="../greetpb";
当前路径都变为了./ 如果要想把文件生成到当前路径下,生成命令的.应该写为./ 旧版 protoc --go_out =. --go-grpc_out =. demo.proto 新版 protoc --go_out=./ --go-grpc_out=./ demo.proto
I assume they made some changes for the newest protoc that now require you to set a import path with at least one "/" ?!