Closed xkisu closed 5 years ago
This error also occurs if I just clone the sample-controller repository and run update-codegen.sh
without modifying the repository at all.
Upon further inspection certain generated files get the import path separator correct and some don't, specifically these ones don't:
pkg/client/clientset/versioned/fake/clientset_generated.go
pkg/client/clientset/versioned/typed/samplecontroller/v1alpha1/fake/fake_samplecontroller_client.go
pkg/client/clientset/versioned/typed/samplecontroller/v1alpha1/foo.go
pkg/client/clientset/versioned/typed/samplecontroller/v1alpha1/samplecontroller_client.go
The informers and listers get the imports correct, and most of the clientset except for those specific files above.
I've tracked this down to an issue with code-generator
's client-gen
using path/filepath#Join()
for generating import paths. filepath#Join
uses the OS's file separator and that's why it's using baskslashes, it's usage in some places should be replaced with path#Join
which uses forward slashes.
I'll open a pull request for it when I get a chance.
Hi @xkisu
I met the same issue with you. You mentioned that you will open a pull request for this issue, is there any update?
Thanks a lot.
I downloaded the repo, modified the api files and codegen script to suit my needs and tried to run
update-codegen.sh
from Git Bash, but it failed with these errors.Where
gamepod
is my api name andgameserver
is my CRD. Upon looking in some of the files in the error message I found out that it was using backslashes in import paths for files it generated:However when I run
update-codegen.sh
with the same code on a Linux VPS it runs completely fine and generates the correct import paths so it appears this is a problem caused by the scripts not using the correct path separator under Git Bash/MSYS2.I assume this is less of an issue with sample-controller and probably an issue with
kubernetes/code-generator
orkubernetes/gengo
but I'm not sure where to look so I assume this is the best place to start.Here are the most relevant files: