README

gengo

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 k8s.io/gengo/...

Examples

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.

args/

Package args defines common arguments for a generator binary.

generator/

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

types/

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.

parser/

Package parser parses go source files.

namer/

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.

Contributing

Please see CONTRIBUTING.md for instructions on how to contribute.

Expand ▾ Collapse ▴

Directories

Path Synopsis
Package args has common command-line flags for generation programs.
Package args has common command-line flags for generation programs.
examples
deepcopy-gen
deepcopy-gen is a tool for auto-generating DeepCopy functions.
deepcopy-gen is a tool for auto-generating DeepCopy functions.
deepcopy-gen/output_tests/aliases
This is a test package.
This is a test package.
deepcopy-gen/output_tests/builtins
This is a test package.
This is a test package.
deepcopy-gen/output_tests/interfaces
This is a test package.
This is a test package.
deepcopy-gen/output_tests/maps
This is a test package.
This is a test package.
deepcopy-gen/output_tests/pointer
This is a test package.
This is a test package.
deepcopy-gen/output_tests/slices
This is a test package.
This is a test package.
deepcopy-gen/output_tests/structs
This is a test package.
This is a test package.
deepcopy-gen/output_tests/wholepkg
This is a test package.
This is a test package.
defaulter-gen
defaulter-gen is a tool for auto-generating Defaulter functions.
defaulter-gen is a tool for auto-generating Defaulter functions.
defaulter-gen/_output_tests/empty
This is a test package.
This is a test package.
defaulter-gen/_output_tests/marker
This is a test package.
This is a test package.
defaulter-gen/_output_tests/pointer
This is a test package.
This is a test package.
defaulter-gen/_output_tests/slices
This is a test package.
This is a test package.
defaulter-gen/_output_tests/wholepkg
This is a test package.
This is a test package.
import-boss
import-boss enforces import restrictions in a given repository.
import-boss enforces import restrictions in a given repository.
import-boss/generators
Package generators has the generators for the import-boss utility.
Package generators has the generators for the import-boss utility.
import-boss/tests/inverse/a
a only imports public packages.
a only imports public packages.
import-boss/tests/inverse/b
b only imports public and private packages.
b only imports public and private packages.
import-boss/tests/inverse/c
c imports the library root, which in turn imports the public and private packages.
c imports the library root, which in turn imports the public and private packages.
import-boss/tests/inverse/d
c imports non-prod code.
c imports non-prod code.
import-boss/tests/inverse/lib/nonprod
nonprod is non-production code that should not be linked into any outside package.
nonprod is non-production code that should not be linked into any outside package.
import-boss/tests/inverse/lib/quarantine
quarantine is inside the library, but should not import the private package.
quarantine is inside the library, but should not import the private package.
import-boss/tests/rules/b
b only public and private packages.
b only public and private packages.
set-gen
set-gen is an example usage of go2idl.
set-gen is an example usage of go2idl.
set-gen/generators
Package generators has the generators for the set-gen utility.
Package generators has the generators for the set-gen utility.
set-gen/sets
Package sets has auto-generated set types.
Package sets has auto-generated set types.
set-gen/sets/types
Package types just provides input types to the set generator.
Package types just provides input types to the set generator.
Package generator defines an interface for code generators to implement.
Package generator defines an interface for code generators to implement.
Package namer has support for making different type naming systems.
Package namer has support for making different type naming systems.
Package parser provides code to parse go files, type-check them, extract the types.
Package parser provides code to parse go files, type-check them, extract the types.
Package types contains go type information, packaged in a way that makes auto-generation convenient, whether by template or straight go functions.
Package types contains go type information, packaged in a way that makes auto-generation convenient, whether by template or straight go functions.