forked from kubernetes-sigs/controller-tools
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path.run-controller-gen.sh
More file actions
executable file
·30 lines (26 loc) · 941 Bytes
/
Copy path.run-controller-gen.sh
File metadata and controls
executable file
·30 lines (26 loc) · 941 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env bash
# This builds and runs controller-gen in a particular context
# it's the equivalent of `go run sigs.k8s.io/controller-tools/cmd/controller-gen`
# if you could somehow do that without modifying your go.mod.
set -o errexit
set -o nounset
set -o pipefail
readlink=$(command -v readlink)
check_readlink() {
local test_file="$(mktemp)"
trap "rm -f $test_file" EXIT
if ! ${readlink} -f "$test_file" &>/dev/null; then
if [[ "${OSTYPE}" == "darwin"* ]]; then
if command -v greadlink; then
readlink=$(command -v greadlink)
return
fi
fi
echo "you're probably on OSX. Please install gnu readlink -- otherwise you're missing the most useful readlink flag."
exit 1
fi
}
current_dir=$(pwd)
check_readlink
cd $(dirname $(${readlink} -f ${BASH_SOURCE[0]}))
go run -v -exec "./.run-in.sh ${current_dir} " ./cmd/controller-gen $@