Fix `line 55: ldflags[*]: unbound variable`

This is caused by bash thinking that an empty array is the same as an
undefined variable and `set -o nounset` treating that as an error.

Fix that by using an empty string as the default for the expansion.

Fixes PR #1069 (6e25f60288).

Tested:
- Before this patch:
  $ mv .git .gitbackup
  $ hack/build-go.sh
  /home/filbranden/devel/kubernetes/hack/config-go.sh: line 55: ldflags[*]: unbound variable

- After this patch:
  $ mv .git .gitbackup
  $ rm -rf output/
  $ hack/build-go.sh
  $ output/go/bin/kubelet -version
  Kubernetes version 0.1+, build (unknown)

Signed-off-by: Filipe Brandenburger <filbranden@google.com>
pull/6/head
Filipe Brandenburger 2014-08-27 19:00:41 -07:00
parent 0965c4ee77
commit e33d4678e6
1 changed files with 1 additions and 1 deletions

View File

@ -52,7 +52,7 @@ kube::version_ldflags() {
fi
# The -ldflags parameter takes a single string, so join the output.
echo "${ldflags[*]}"
echo "${ldflags[*]-}"
)
}