| 1 |
# gengo |
| 2 |
|
| 3 |
[![Travis Widget]][Travis] [![GoDoc Widget]][GoDoc] [![GoReport]][GoReportStatus] |
| 4 |
|
| 5 |
[Travis]: https://travis-ci.org/kubernetes/gengo |
| 6 |
[Travis Widget]: https://travis-ci.org/kubernetes/gengo.svg?branch=master |
| 7 |
[GoDoc]: https://godoc.org/k8s.io/gengo |
| 8 |
[GoDoc Widget]: https://godoc.org/k8s.io/gengo?status.svg |
| 9 |
[GoReport]: https://goreportcard.com/badge/github.com/kubernetes/gengo |
| 10 |
[GoReportStatus]: https://goreportcard.com/report/github.com/kubernetes/gengo |
| 11 |
|
| 12 |
NOTE: [`k8s.io/gengo/v2`](https://github.com/kubernetes/gengo/tree/master/v2) is the current development module. |
| 13 |
|
| 14 |
A package for generating things based on go files. This mechanism was first used |
| 15 |
in [Kubernetes code-generator](https://github.com/kubernetes/kubernetes/tree/master/staging/src/k8s.io/code-generator) and is split out here for ease of reuse and maintainability. |
| 16 |
|
| 17 |
`go get k8s.io/gengo/...` |
| 18 |
|
| 19 |
## Examples |
| 20 |
|
| 21 |
A set generator, deep-copy generator, defaulter generator and go-to-protobuf |
| 22 |
generator are included here. Also, import-boss will enforce arbitrary rules about |
| 23 |
import trees. |
| 24 |
|
| 25 |
## args/ |
| 26 |
|
| 27 |
Package args defines common arguments for a generator binary. |
| 28 |
|
| 29 |
## generator/ |
| 30 |
|
| 31 |
Package generator defines interfaces for code generators to implement, and |
| 32 |
machinery that will execute those code generators. |
| 33 |
|
| 34 |
## types/ |
| 35 |
|
| 36 |
Package types contains the type system definition. It is modeled after Go's type |
| 37 |
system, but it's intended that you could produce these types by parsing |
| 38 |
something else, if you want to write the parser/converter. |
| 39 |
|
| 40 |
We don't directly use the go types in the go typecheck library because they are |
| 41 |
based on implementing differing interfaces. A struct-based format is more |
| 42 |
convenient input for template driven output. |
| 43 |
|
| 44 |
## parser/ |
| 45 |
|
| 46 |
Package parser parses go source files. |
| 47 |
|
| 48 |
## namer/ |
| 49 |
|
| 50 |
Package namer defines a naming system, for: |
| 51 |
* helping you reference go objects in a syntactically correct way |
| 52 |
* keeping track of what you reference, for importing the right packages |
| 53 |
* and defining parallel tracks of names, for making public interfaces and |
| 54 |
private implementations. |
| 55 |
|
| 56 |
## Contributing |
| 57 |
|
| 58 |
Please see [CONTRIBUTING.md](CONTRIBUTING.md) for instructions on how to contribute. |