Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deepcopy-gen relative output without symlinks #133

Closed
austince opened this issue Sep 29, 2021 · 7 comments · Fixed by kubernetes/kubernetes#106964
Closed

deepcopy-gen relative output without symlinks #133

austince opened this issue Sep 29, 2021 · 7 comments · Fixed by kubernetes/kubernetes#106964
Assignees
Labels
lifecycle/active Indicates that an issue or PR is actively being worked on by a contributor. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. triage/accepted Indicates an issue or PR is ready to be actively worked on.

Comments

@austince
Copy link

austince commented Sep 29, 2021

deepcopy-gen currently writes output exclusively to the GOPATH. 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:

deepcopy-gen -i github.com/austince/apiserver/apis/v1 \
  -O zz_generated.deepcopy \
  -o . \
  --pkg-mappings github.com/austince/apiserver=./apiserver

where we could map package roots to directories relative to the -o input, so the output github.com/austince/apiserver/apis/v1/zz_generated.deepcopy.go would be written to ./apiserver/apis/v1/zz_generated.deepcopy.go.

@austince
Copy link
Author

/sig api-machinery

@k8s-ci-robot k8s-ci-robot added the sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. label Sep 29, 2021
@austince austince changed the title deepcopy-gen output w/in Go modules project deepcopy-gen relative output without symlinks Sep 29, 2021
@jpbetz
Copy link
Contributor

jpbetz commented Sep 30, 2021

/cc @jpbetz
/triage accepted

@k8s-ci-robot k8s-ci-robot added the triage/accepted Indicates an issue or PR is ready to be actively worked on. label Sep 30, 2021
@ncdc
Copy link
Member

ncdc commented Nov 15, 2021

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.

@ncdc
Copy link
Member

ncdc commented Nov 15, 2021

PR: kubernetes/gengo#221

@ncdc
Copy link
Member

ncdc commented Nov 15, 2021

/assign

@ncdc
Copy link
Member

ncdc commented Nov 15, 2021

/lifecycle active

@k8s-ci-robot k8s-ci-robot added the lifecycle/active Indicates that an issue or PR is actively being worked on by a contributor. label Nov 15, 2021
@ncdc
Copy link
Member

ncdc commented Dec 10, 2021

Sorry it took so long - just opened a PR for this in Kubernetes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lifecycle/active Indicates that an issue or PR is actively being worked on by a contributor. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants