command module
Version: v1.0.0 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Nov 17, 2015 License: MIT Imports: 11 Imported by: 0


##GenKit This is a proof of concept go generator that generates everything but the main package to create a service from one of your types.

It's slightly opinionated, in that I needed a service that publishes to statsd, so I used the statsd metrics package. We also standardized on Logrus at $work so this uses logrus instead of kit/log. Pull requests to make this optional/switchable are welcome.

Given this type:

type User struct {
	ID string
	Name string

to create a go-kit HTTP/JSON service, you simply need to annotate the type with a comment like this:

// @service
type User struct {
	ID string
	Name string

and add //go:generate genkit $GOFILE as the first line of the file containing the type.

GenKit will generate files based on the example services in GoKit's repository. All that's missing is a main.go in a parent directory.

Simplified example main :

package main
import (
	... some packages ...
func main() {
	ctx := context.Background()
	http.Handle("/users/", http.StripPrefix("/users", user.GetMux(ctx)))
	listen := fmt.Sprintf(":%d", port)
	err:= http.ListenAndServe(listen, nil)


go get



based on gokit which is MIT licensed by Peter Bourgon

Much of the code generation code is directly lifted from Brett Slatkin's awesome example: That code is Apache licensed.


The Go Gopher

There is no documentation for this package.


Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL