Skip to content

Commit f7e6b7a

Browse files
authored
Add support for GOBIN to generate-groups.sh.
This still honors `$GOPATH` if it is set, but no longer requires it to be set, and also honors `$GOBIN` if it is set. Fixes https://github.com/kubernetes/code-generator/issues/87
1 parent 78d2e52 commit f7e6b7a

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

staging/src/k8s.io/code-generator/generate-groups.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ shift 4
5252
cd "$(dirname "${0}")"
5353
go install ./cmd/{defaulter-gen,client-gen,lister-gen,informer-gen,deepcopy-gen}
5454
)
55+
# We expect the above commands to get installed here:
56+
gobin="$(go env GOBIN)"
5557

5658
function codegen::join() { local IFS="$1"; shift; echo "$*"; }
5759

@@ -68,22 +70,22 @@ done
6870

6971
if [ "${GENS}" = "all" ] || grep -qw "deepcopy" <<<"${GENS}"; then
7072
echo "Generating deepcopy funcs"
71-
"${GOPATH}/bin/deepcopy-gen" --input-dirs "$(codegen::join , "${FQ_APIS[@]}")" -O zz_generated.deepcopy --bounding-dirs "${APIS_PKG}" "$@"
73+
"${gobin}/deepcopy-gen" --input-dirs "$(codegen::join , "${FQ_APIS[@]}")" -O zz_generated.deepcopy --bounding-dirs "${APIS_PKG}" "$@"
7274
fi
7375

7476
if [ "${GENS}" = "all" ] || grep -qw "client" <<<"${GENS}"; then
7577
echo "Generating clientset for ${GROUPS_WITH_VERSIONS} at ${OUTPUT_PKG}/${CLIENTSET_PKG_NAME:-clientset}"
76-
"${GOPATH}/bin/client-gen" --clientset-name "${CLIENTSET_NAME_VERSIONED:-versioned}" --input-base "" --input "$(codegen::join , "${FQ_APIS[@]}")" --output-package "${OUTPUT_PKG}/${CLIENTSET_PKG_NAME:-clientset}" "$@"
78+
"${gobin}/client-gen" --clientset-name "${CLIENTSET_NAME_VERSIONED:-versioned}" --input-base "" --input "$(codegen::join , "${FQ_APIS[@]}")" --output-package "${OUTPUT_PKG}/${CLIENTSET_PKG_NAME:-clientset}" "$@"
7779
fi
7880

7981
if [ "${GENS}" = "all" ] || grep -qw "lister" <<<"${GENS}"; then
8082
echo "Generating listers for ${GROUPS_WITH_VERSIONS} at ${OUTPUT_PKG}/listers"
81-
"${GOPATH}/bin/lister-gen" --input-dirs "$(codegen::join , "${FQ_APIS[@]}")" --output-package "${OUTPUT_PKG}/listers" "$@"
83+
"${gobin}/lister-gen" --input-dirs "$(codegen::join , "${FQ_APIS[@]}")" --output-package "${OUTPUT_PKG}/listers" "$@"
8284
fi
8385

8486
if [ "${GENS}" = "all" ] || grep -qw "informer" <<<"${GENS}"; then
8587
echo "Generating informers for ${GROUPS_WITH_VERSIONS} at ${OUTPUT_PKG}/informers"
86-
"${GOPATH}/bin/informer-gen" \
88+
"${gobin}/informer-gen" \
8789
--input-dirs "$(codegen::join , "${FQ_APIS[@]}")" \
8890
--versioned-clientset-package "${OUTPUT_PKG}/${CLIENTSET_PKG_NAME:-clientset}/${CLIENTSET_NAME_VERSIONED:-versioned}" \
8991
--listers-package "${OUTPUT_PKG}/listers" \

0 commit comments

Comments
 (0)