gengo library for code generation.
Switch branches/tags
Nothing to show
Clone or download
Latest commit 4242d8e Aug 14, 2018


Travis Widget GoDoc Widget GoReport

A package for generating things based on go files. This mechanism was first used in Kubernetes and is split out here for ease of reuse and maintainability.

go get


A set generator, deep-copy generator, defaulter generator and go-to-protobuf generator are included here. Also, import-boss will enforce arbitrary rules about import trees.


Package args defines common arguments for a generator binary.


Package generator defines interfaces for code generators to implement, and machinery that will execute those code generators.


Package types contains the type system definition. It is modeled after Go's type system, but it's intended that you could produce these types by parsing something else, if you want to write the parser/converter.

We don't directly use the go types in the go typecheck library because they are based on implementing differing interfaces. A struct-based format is more convenient input for template driven output.


Package parser parses go source files.


Package namer defines a naming system, for:

  • helping you reference go objects in a syntactically correct way
  • keeping track of what you reference, for importing the right packages
  • and defining parallel tracks of names, for making public interfaces and private implementations.


Please see for instructions on how to contribute.