Skip to content

Commit

Permalink
Fix spacing in usage_from_stdin and info_from_stdin (issue kubernetes…
Browse files Browse the repository at this point in the history
…#24186).

If "a" is a bash array, then the syntax to append the contents of $line as a
new element to the array is a+=("$line"), not messages+=$line

Using the former syntax just seems to append to the first element, creating a
long string and thus losing newline information.

Fixing this allows us to drop some empty lines from invocations of
usage_from_stdin.
  • Loading branch information
Marcin Owsiany committed Apr 14, 2016
1 parent d800dca commit 9ce8552
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
4 changes: 2 additions & 2 deletions cluster/lib/logging.sh
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ kube::log::usage() {
kube::log::usage_from_stdin() {
local messages=()
while read -r line; do
messages+=$line
messages+=("$line")
done

kube::log::usage "${messages[@]}"
Expand All @@ -129,7 +129,7 @@ kube::log::progress() {
kube::log::info_from_stdin() {
local messages=()
while read -r line; do
messages+=$line
messages+=("$line")
done

kube::log::info "${messages[@]}"
Expand Down
4 changes: 0 additions & 4 deletions hack/lib/golang.sh
Original file line number Diff line number Diff line change
Expand Up @@ -264,10 +264,8 @@ kube::golang::setup_env() {

if [[ -z "$(which go)" ]]; then
kube::log::usage_from_stdin <<EOF
Can't find 'go' in PATH, please fix and retry.
See http://golang.org/doc/install for installation instructions.
EOF
exit 2
fi
Expand All @@ -280,11 +278,9 @@ EOF
go_version=($(go version))
if [[ "${go_version[2]}" < "go1.4" ]]; then
kube::log::usage_from_stdin <<EOF
Detected go version: ${go_version[*]}.
Kubernetes requires go version 1.4 or greater.
Please install Go version 1.4 or later.
EOF
exit 2
fi
Expand Down

0 comments on commit 9ce8552

Please sign in to comment.