Documentation ¶
Overview ¶
conversion-gen is a tool for auto-generating Conversion functions.
Given a list of input directories, it will scan for "peer" packages and generate functions that efficiently convert between same-name types in each package. For any pair of types that has a
`Convert_<pkg1>_<type>_To_<pkg2>_<Type()`
function (and its reciprocal), it will simply call that. use standard value assignment whenever possible. The resulting file will be stored in the same directory as the processed source package.
Generation is governed by comment tags in the source. Any package may request Conversion generation by including a comment in the file-comments of one file, of the form:
// +k8s:conversion-gen=<import-path-of-peer-package>
When generating for a package, individual types or fields of structs may opt out of Conversion generation by specifying a comment on the of the form:
// +k8s:conversion-gen=false