oakkose
oakkose

Reputation: 405

Golang Protoc Compiler Command relative_path problem

I try to learn gprc in golang. I write a .proto calling service.proto and try to compile it with this command:

protoc --go_out=. --go_opt=paths=source_relative \
--go-grpc_out=. --go-grpc_opt=paths=source_relative\
proto/service.proto

But I am not sure what I write instead of source_relative. I tried to write "protoc-gen-go.exe" and "protoc-gen-go.exe" packages path but it throws this error:

protoc-gen-go: unknown path type "C:/Users/Onur/go/bin": want "import" or "source_relative"

This is my .proto file:

syntax = "proto3";

package proto;

message Request {
    int64 a = 1;
    int64 b = 2;
}

message Response {
    int64 result = 1;
}

service AddService {
    rpc Add(Request) returns(Response);
    rpc Multiply(Request) returns(Response);
}

Upvotes: 2

Views: 574

Answers (1)

derv-dice
derv-dice

Reputation: 70

mistake in this place:

--go-grpc_opt=paths=source_relative\

there are must be space before \ symbol

try this (works for me):

protoc --go_out=. --go_opt=paths=source_relative \
--go-grpc_out=. --go-grpc_opt=paths=source_relative \
proto/service.proto

Upvotes: 1

Related Questions