truss/gengokit
Ian Molee f610ad57bb Update go-bindata-generated template.go 2016-12-07 17:08:42 -08:00
..
clientarggen Use all GOPATH's rather than just first 2016-11-16 16:24:14 -08:00
generator Merge pull request #103 from hasAdamr/remove-truss-namedreadwriter 2016-12-06 10:53:22 -08:00
gentesthelper Move TestUpdateMethods to handler package for clarity 2016-12-05 12:22:35 -08:00
handler Move TestUpdateMethods to handler package for clarity 2016-12-05 12:22:35 -08:00
httptransport Update regeneration of handler file to not remove unexported functions 2016-11-16 17:03:55 -08:00
middlewares Update based on pull request feedback 2016-12-05 13:51:56 -08:00
template Update go-bindata-generated template.go 2016-12-07 17:08:42 -08:00
README.md Separate doc generation from definition structure 2016-09-12 11:37:15 -07:00
gengokit.go Remove the truss.NamedReadWriter interface and truss.SimpleFile struct. 2016-12-02 17:51:05 -08:00
gengokit_test.go Update based on pull request feedback 2016-12-02 16:46:00 -08:00

README.md

gengokit

gengokit is a truss plugin that from a deftree and []truss.SimpleFile

  1. Generates Golang code for a gokit microservice that includes:
    • Logging
    • Metrics/Instrumentation
    • gRPC transport
    • http/json transport (including all encoding/decoding)
    • no-op handler methods for each service rpc, ready for business logic to be added
  2. Generates Golang code for a cli gokit microservice client that includes:
    • gRPC transport
    • http/json transport (including all encoding/decoding)
    • handler methods that marshal command line arguments into server requests
  3. Parses code previously generated by protoc-gen-truss-gokit and inserts/removes handler methods/rpcs that are defined/removed from the definition

Development

Build

$ go generate github.com/TuneLab/go-truss/... $ go install github.com/TuneLab/go-truss/...

Test

make test from the $GOPATH/src/github.com/TuneLab/go-truss/truss directory runs the integration tests

Structure

./template/service contain go text/template files that represent a gokit microservice

./astmodifier provides functions to modify source code already generated and/or user modified.

gengokit.go executes the template files using deftree's representation of the protoc AST. ./generator also uses ./astmodifier to rewrite code to insert/remove handler methods/rpcs that are defined/removed from a definition file without touching user written logic.

NOTE:

  • No Service rpc methods named "NewBasicService" allowed for generation reasons