From 14eaac289b1a700107c11b583b2ee6d2eb611fde Mon Sep 17 00:00:00 2001 From: Alex Szakaly Date: Wed, 4 Mar 2020 22:25:25 +0100 Subject: [PATCH] doc: add workaround for hack/update-generated-code.sh code-generator incorrectly resolve package path: wants to write into v2/ directory instead of resolving v2 as package path Provide steps to successfully execute code-generator Signed-off-by: Alex Szakaly --- hack/README.md | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/hack/README.md b/hack/README.md index abbf2706..f2189685 100644 --- a/hack/README.md +++ b/hack/README.md @@ -10,7 +10,35 @@ This is the script to update clientset/informers/listers and API deepcopy code u Make sure to run this script after making changes to /pkg/apis/volumesnapshot/v1beta1/types.go. -To run this script, simply run: ./hack/update-generated-code.sh from the project root directory. +To run this script, you have to patch it: +```patch +diff --git a/hack/update-generated-code.sh b/hack/update-generated-code.sh +--- a/hack/update-generated-code.sh ++++ b/hack/update-generated-code.sh +@@ -27,7 +27,7 @@ CODEGEN_PKG=${CODEGEN_PKG:-$(cd ${SCRIPT_ROOT}; ls -d -1 ./vendor/k8s.io/code-ge + # k8s.io/kubernetes. The output-base is needed for the generators to output into the vendor dir + # instead of the $GOPATH directly. For normal projects this can be dropped. + bash ${CODEGEN_PKG}/generate-groups.sh "deepcopy,client,informer,lister" \ +- github.com/kubernetes-csi/external-snapshotter/pkg/client github.com/kubernetes-csi/external-snapshotter/pkg/apis \ ++ github.com/kubernetes-csi/external-snapshotter/v2/pkg/client github.com/kubernetes-csi/external-snapshotter/v2/pkg/apis \ + volumesnapshot:v1beta1 \ + --go-header-file ${SCRIPT_ROOT}/hack/boilerplate.go.txt +``` + +Once you are done with patching, continue: +```bash +rm -fr v2/ +ln -sfvn $(pwd) v2 +rm -fr pkg/client +``` + +Run: ./hack/update-generated-code.sh from the project root directory. + +Do not forget to revert previously applied workaround: +```bash +git checkout -- v2/ +git checkout -- hack/update-generated-code.sh +``` ## update-crd.sh