Commit d40bf503 authored by k8s-merge-robot's avatar k8s-merge-robot

Merge pull request #24256 from porridge/fix-newlines

Automatic merge from submit-queue Fix spacing in usage_from_stdin and info_from_stdin (issue #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.
parents b5b190df 9ce85526
...@@ -106,7 +106,7 @@ kube::log::usage() { ...@@ -106,7 +106,7 @@ kube::log::usage() {
kube::log::usage_from_stdin() { kube::log::usage_from_stdin() {
local messages=() local messages=()
while read -r line; do while read -r line; do
messages+=$line messages+=("$line")
done done
kube::log::usage "${messages[@]}" kube::log::usage "${messages[@]}"
...@@ -129,7 +129,7 @@ kube::log::progress() { ...@@ -129,7 +129,7 @@ kube::log::progress() {
kube::log::info_from_stdin() { kube::log::info_from_stdin() {
local messages=() local messages=()
while read -r line; do while read -r line; do
messages+=$line messages+=("$line")
done done
kube::log::info "${messages[@]}" kube::log::info "${messages[@]}"
......
...@@ -268,10 +268,8 @@ kube::golang::setup_env() { ...@@ -268,10 +268,8 @@ kube::golang::setup_env() {
if [[ -z "$(which go)" ]]; then if [[ -z "$(which go)" ]]; then
kube::log::usage_from_stdin <<EOF kube::log::usage_from_stdin <<EOF
Can't find 'go' in PATH, please fix and retry. Can't find 'go' in PATH, please fix and retry.
See http://golang.org/doc/install for installation instructions. See http://golang.org/doc/install for installation instructions.
EOF EOF
exit 2 exit 2
fi fi
...@@ -284,11 +282,9 @@ EOF ...@@ -284,11 +282,9 @@ EOF
go_version=($(go version)) go_version=($(go version))
if [[ "${go_version[2]}" < "go1.4" ]]; then if [[ "${go_version[2]}" < "go1.4" ]]; then
kube::log::usage_from_stdin <<EOF kube::log::usage_from_stdin <<EOF
Detected go version: ${go_version[*]}. Detected go version: ${go_version[*]}.
Kubernetes requires go version 1.4 or greater. Kubernetes requires go version 1.4 or greater.
Please install Go version 1.4 or later. Please install Go version 1.4 or later.
EOF EOF
exit 2 exit 2
fi fi
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment