Skip to content

Commit 3b12266

Browse files
authored
Merge pull request kubernetes#76803 from cblecker/goldflags-fix
Fix shellcheck in hack/lib/golang.sh
2 parents 9e6ed27 + 4543e68 commit 3b12266

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

hack/.shellcheck_failures

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
./hack/cherry_pick_pull.sh
2828
./hack/ginkgo-e2e.sh
2929
./hack/grab-profiles.sh
30-
./hack/lib/golang.sh
3130
./hack/lib/init.sh
3231
./hack/lib/swagger.sh
3332
./hack/lib/test.sh

hack/lib/golang.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ EOF
372372

373373
# Ensure the go tool exists and is a viable version.
374374
kube::golang::verify_go_version() {
375-
if [[ -z "$(which go)" ]]; then
375+
if [[ -z "$(command -v go)" ]]; then
376376
kube::log::usage_from_stdin <<EOF
377377
Can't find 'go' in PATH, please fix and retry.
378378
See http://golang.org/doc/install for installation instructions.
@@ -693,6 +693,10 @@ kube::golang::build_binaries() {
693693
host_platform=$(kube::golang::host_platform)
694694

695695
local goflags goldflags goasmflags gogcflags
696+
# If GOLDFLAGS is unset, then set it to the a default of "-s -w".
697+
# Disable SC2153 for this, as it will throw a warning that the local
698+
# variable goldflags will exist, and it suggest changing it to this.
699+
# shellcheck disable=SC2153
696700
goldflags="${GOLDFLAGS=-s -w} $(kube::version::ldflags)"
697701
goasmflags="-trimpath=${KUBE_ROOT}"
698702
gogcflags="${GOGCFLAGS:-} -trimpath=${KUBE_ROOT}"

0 commit comments

Comments
 (0)