Archive

Archive for March, 2015

protoc grpc golang

March 21, 2015 Leave a comment

How to generate code from proto files..

1. I had visualstudio 2010 with me and straight away i was not able to compile and generate protoc.exe. It threw lot of LNK errors. So i did install service pack of VS2010 to get rid of them.

2. Rebuilding the generated code as specified in https://github.com/grpc/grpc-common/tree/master/go

The commands that were given there were not clear, you have to do few things..

a.  go get google.golang.org/grpc

b.  Grab the code from the repository and install the proto package.

go get -u github.com/golang/protobuf/{proto,protoc-gen-go}   do get both of them..

c.  set PATH=%PATH%;C:\code\go\bin

d. go to protoc-gen-go folder and build it.

e. Also set protoc.exe in the patch. (“the one you have built using visual studio).

f. Now you can generate code for proto files by typing ..

protoc –go_out=. helloworld.proto

Update : You can get protoc.exe from https://github.com/google/protobuf/releases/tag/v3.0.0-alpha-2 as well.

Categories: Uncategorized Tags: ,