mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-01 15:58:37 +00:00
kube_codegen: smarter grepping of codegen tags
Be smarter about finding the input packages for genclient et al. The previous grep patterns were too generic. This caused code-generator, for example, to pick up it's own auto-generated packages. In this particular case having a status field in the type adds a comment to the autogenerated code like: // Add a +genclient:noStatus comment above the type... This, in turn causes problems in some scenarios where the input (api) and the target package for the auto-generated code reside in separate go modules.
This commit is contained in:
parent
68091805a5
commit
fbb441cf8a
@ -121,7 +121,7 @@ function kube::codegen::gen_helpers() {
|
|||||||
input_pkgs+=("${pkg}")
|
input_pkgs+=("${pkg}")
|
||||||
done < <(
|
done < <(
|
||||||
( kube::codegen::internal::grep -l --null \
|
( kube::codegen::internal::grep -l --null \
|
||||||
-e '+k8s:deepcopy-gen=' \
|
-e '^\s*//\s*+k8s:deepcopy-gen=' \
|
||||||
-r "${in_dir}" \
|
-r "${in_dir}" \
|
||||||
--include '*.go' \
|
--include '*.go' \
|
||||||
|| true \
|
|| true \
|
||||||
@ -153,7 +153,7 @@ function kube::codegen::gen_helpers() {
|
|||||||
input_pkgs+=("${pkg}")
|
input_pkgs+=("${pkg}")
|
||||||
done < <(
|
done < <(
|
||||||
( kube::codegen::internal::grep -l --null \
|
( kube::codegen::internal::grep -l --null \
|
||||||
-e '+k8s:defaulter-gen=' \
|
-e '^\s*//\s*+k8s:defaulter-gen=' \
|
||||||
-r "${in_dir}" \
|
-r "${in_dir}" \
|
||||||
--include '*.go' \
|
--include '*.go' \
|
||||||
|| true \
|
|| true \
|
||||||
@ -185,7 +185,7 @@ function kube::codegen::gen_helpers() {
|
|||||||
input_pkgs+=("${pkg}")
|
input_pkgs+=("${pkg}")
|
||||||
done < <(
|
done < <(
|
||||||
( kube::codegen::internal::grep -l --null \
|
( kube::codegen::internal::grep -l --null \
|
||||||
-e '+k8s:conversion-gen=' \
|
-e '^\s*//\s*+k8s:conversion-gen=' \
|
||||||
-r "${in_dir}" \
|
-r "${in_dir}" \
|
||||||
--include '*.go' \
|
--include '*.go' \
|
||||||
|| true \
|
|| true \
|
||||||
@ -338,7 +338,7 @@ function kube::codegen::gen_openapi() {
|
|||||||
input_pkgs+=("${pkg}")
|
input_pkgs+=("${pkg}")
|
||||||
done < <(
|
done < <(
|
||||||
( kube::codegen::internal::grep -l --null \
|
( kube::codegen::internal::grep -l --null \
|
||||||
-e '+k8s:openapi-gen=' \
|
-e '^\s*//\s*+k8s:openapi-gen=' \
|
||||||
-r "${in_dir}" \
|
-r "${in_dir}" \
|
||||||
--include '*.go' \
|
--include '*.go' \
|
||||||
|| true \
|
|| true \
|
||||||
@ -568,7 +568,7 @@ function kube::codegen::gen_client() {
|
|||||||
fi
|
fi
|
||||||
done < <(
|
done < <(
|
||||||
( kube::codegen::internal::grep -l --null \
|
( kube::codegen::internal::grep -l --null \
|
||||||
-e '+genclient' \
|
-e '^\s*//\s*+genclient' \
|
||||||
-r "${in_dir}${one_input_api}" \
|
-r "${in_dir}${one_input_api}" \
|
||||||
--include '*.go' \
|
--include '*.go' \
|
||||||
|| true \
|
|| true \
|
||||||
|
Loading…
Reference in New Issue
Block a user