- Everything required to install
truss - go-bindata for compiling templates into binary
$ go get github.com/jteeuwen/go-bindata/...
Whenever templates are modified, the templates must be recompiled to binary, this is done with:
$ go generate github.com/metaverse/truss/...
Then to build truss and its protoc plugin to your $GOPATH/bin directory:
$ go install github.com/metaverse/truss/...
Both can be done from the Makefile in the root directory:
$ cd $GOPATH/github.com/metaverse/truss
$ make
Before submitting a pull request always run tests that cover modified code. Also build truss and run truss's integration test. This can be done by
$ cd $GOPATH/src/github.com/metaverse/truss
$ make
$ make test
# If the tests failed and you want to remove generated code
$ make testclean
Truss works as follows:
- Read in a group of
.protofiles - Execute
protocwith ourprotoc-gen-protocastprotoc plugin, which outputs the protoc AST representation of the .proto files - Parse protoc's AST output and the
.protofile with thegrpc Servicedefinition for http annotations usinggo-truss/deftree - Use
protocandprotoc-gen-goto generate.pb.gofiles containing protobuf structs and transport for golang - Use the constructed
deftreewithgengokitto template out basic gokit service with grpc and http/json transport and empty handlers - Generate documentation from comments with
gendocs
If there was already generated code in the filesystem then truss will not overwrite user code in the /NAME-service/handlers directory
Additional internal packages of note used by these programs are:
deftree, located indeftree/, which makes sense of the protobuf file passed to it byprotoc, and is used bygengokitandgendoc