11#! /usr/bin/env bash
2+ # shellcheck disable=SC2086
3+ # Double quote to prevent globbing and word splitting. dont apply for this specific scenario
24
35# Copyright 2020 The Kubernetes Authors.
46#
@@ -18,14 +20,17 @@ set -o errexit
1820set -o nounset
1921set -o pipefail
2022
21- readonly SCRIPT_ROOT=" $( cd " $( dirname " ${BASH_SOURCE} " ) " /.. && pwd) "
23+ SCRIPT_ROOT=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " /.. && pwd) "
24+ readonly SCRIPT_ROOT
2225
2326# Keep outer module cache so we don't need to redownload them each time.
2427# The build cache already is persisted.
25- readonly GOMODCACHE=" $( go env GOMODCACHE) "
28+ GOMODCACHE=" $( go env GOMODCACHE) "
29+ readonly GOMODCACHE
2630readonly GO111MODULE=" on"
2731readonly GOFLAGS=" -mod=readonly"
28- readonly GOPATH=" $( mktemp -d) "
32+ GOPATH=" $( mktemp -d) "
33+ readonly GOPATH
2934readonly MIN_REQUIRED_GO_VER=" 1.19"
3035
3136function go_version_matches {
@@ -79,16 +84,14 @@ go run k8s.io/code-generator/cmd/informer-gen \
7984--output-package " ${OUTPUT_PKG} /informers" \
8085${COMMON_FLAGS}
8186
82- for VERSION in v1alpha1 # # Add more versions eventually
83- do
84- echo " Generating ${VERSION} register at ${APIS_PKG} /apis/${VERSION} "
85- go run k8s.io/code-generator/cmd/register-gen \
86- --input-dirs " ${APIS_PKG} /apis/${VERSION} " \
87- --output-package " ${APIS_PKG} /apis/${VERSION} " \
88- ${COMMON_FLAGS}
89-
90- echo " Generating ${VERSION} deepcopy at ${APIS_PKG} /apis/${VERSION} "
91- go run sigs.k8s.io/controller-tools/cmd/controller-gen \
92- object:headerFile=${SCRIPT_ROOT} /hack/boilerplate.generatego.txt \
93- paths=" ${APIS_PKG} /apis/${VERSION} "
94- done
87+ VERSION=v1alpha1
88+ echo " Generating ${VERSION} register at ${APIS_PKG} /apis/${VERSION} "
89+ go run k8s.io/code-generator/cmd/register-gen \
90+ --input-dirs " ${APIS_PKG} /apis/${VERSION} " \
91+ --output-package " ${APIS_PKG} /apis/${VERSION} " \
92+ ${COMMON_FLAGS}
93+
94+ echo " Generating ${VERSION} deepcopy at ${APIS_PKG} /apis/${VERSION} "
95+ go run sigs.k8s.io/controller-tools/cmd/controller-gen \
96+ object:headerFile=" ${SCRIPT_ROOT} /hack/boilerplate.generatego.txt" \
97+ paths=" ${APIS_PKG} /apis/${VERSION} "
0 commit comments