On this post I have added some of the logs while experimenting Twirp ,a simple RPC framework built on protobuf.
On such Error :
esumits-MacBook-Pro:haberdasher esumit$ protoc –proto_path=/Users/esumit/go/src:. –twirp_out=. –go_out=. service.proto
protoc-gen-twirp: program not found or is not executable
–twirp_out: protoc-gen-twirp: Plugin failed with status code 1.
Make sure propers paths are set up in .bash_profile
esumits-MacBook-Pro:~ esumit$ retool
usage: retool (add | remove | upgrade | sync | do | build | help)
use retool with a subcommand:
add will add a tool
remove will remove a tool
upgrade will upgrade a tool
sync will synchronize your _tools with tools.json, downloading if necessary
build will compile all the tools in _tools
do will run stuff using your installed tools
help [command] will describe a command in more detail
version will print the installed version of retool
esumits-MacBook-Pro:~ esumit$ retool add github.com/golang/protobuf/protoc-gen-go master
retool: downloading github.com/golang/protobuf/protoc-gen-go
retool: setting version for github.com/golang/protobuf/protoc-gen-go
retool: parsing revision “master”
retool: parsed as “3a3da3a4e26776cc22a79ef46d5d58477532dede”
retool: installing github.com/golang/protobuf/protoc-gen-go
esumits-MacBook-Pro:~ esumit$
esumits-MacBook-Pro:~ esumit$
esumits-MacBook-Pro:~ esumit$ retool add github.com/twitchtv/twirp/protoc-gen-twirp master
retool: downloading github.com/golang/protobuf/protoc-gen-go
retool: setting version for github.com/golang/protobuf/protoc-gen-go
retool: downloading github.com/twitchtv/twirp/protoc-gen-twirp
retool: setting version for github.com/twitchtv/twirp/protoc-gen-twirp
retool: parsing revision “master”
retool: parsed as “1b8455b42110feb46a56aeec1ea0020067f46b11”
retool: installing github.com/golang/protobuf/protoc-gen-go
retool: installing github.com/twitchtv/twirp/protoc-gen-twirp
esumits-MacBook-Pro:~ esumit$
Finally this Works :
esumits-MacBook-Pro:haberdasher esumit$ protoc –proto_path=$GOPATH/src:. –twirp_out=. –go_out=. service.proto
esumits-MacBook-Pro:haberdasher esumit$ ls
‘ _tools service.pb.go service.proto service.twirp.go
esumits-MacBook-Pro:haberdasher esumit$
Reference : https://twitchtv.github.io/twirp/docs/install.html
Defining golang struct function using pointer or not
http://golangtutorials.blogspot.com.au/2011/06/methods-on-structs.html
https://stackoverflow.com/questions/25382073/defining-golang-struct-function-using-pointer-or-not