Closed austince closed 2 years ago
/sig api-machinery
/cc @jpbetz /triage accepted
I have some local changes to gengo (used by code-generator) that enables (hopefully) all generators to output files while stripping a base path prefix from the output path. For example, if your project is github.com/foo/bar
, and you want to generate a package github.com/foo/bar/generated
, running $some-generator --output-base . --output-package github.com/foo/bar/generated --trim-path-prefix github.com/foo/bar
, it will output to ./generated
while retaining the correct github.com/foo/bar/generated
package name inside the generated files.
I'd also considered doing something like --go-module-mode=true/false
to automatically determine the "trim path prefix" value from go.mod. Definitely open to suggestions for which approach (or possibly others) make the most sense.
Will open a PR shortly for what I currently have.
/assign
/lifecycle active
Sorry it took so long - just opened a PR for this in Kubernetes.
deepcopy-gen
currently writes output exclusively to theGOPATH
. In kubernetes, a local go tree structure is created and symlinked to the working directory. It would be nice if this symlinking was not necessary for correct placement of the generated files.An additional argument might look like:
where we could map package roots to directories relative to the
-o
input, so the outputgithub.com/austince/apiserver/apis/v1/zz_generated.deepcopy.go
would be written to./apiserver/apis/v1/zz_generated.deepcopy.go
.