mirror of
				https://github.com/k3s-io/kubernetes.git
				synced 2025-10-30 21:30:16 +00:00 
			
		
		
		
	hack/lib/golang.sh: use double quotes.
It's admittedly extremely unlikely that the host platform name would contain special characters, but still use double quotes to pattern matching. Consider this script: #!/bin/bash bar="foobar" foo="foo*" [[ $bar == $foo ]] && echo "first true" [[ "$bar" == "$foo" ]] && echo "second true" We get the output: first true The plan is to move from first case to the second case to prevent pattern match where there shouldn't be any.
This commit is contained in:
		| @@ -401,7 +401,7 @@ kube::golang::place_bins() { | ||||
|     # The substitution on platform_src below will replace all slashes with | ||||
|     # underscores.  It'll transform darwin/amd64 -> darwin_amd64. | ||||
|     local platform_src="/${platform//\//_}" | ||||
|     if [[ $platform == $host_platform ]]; then | ||||
|     if [[ "$platform" == "$host_platform" ]]; then | ||||
|       platform_src="" | ||||
|       rm -f "${THIS_PLATFORM_BIN}" | ||||
|       ln -s "${KUBE_OUTPUT_BINPATH}/${platform}" "${THIS_PLATFORM_BIN}" | ||||
| @@ -465,7 +465,7 @@ kube::golang::output_filename_for_binary() { | ||||
|   local binary=$1 | ||||
|   local platform=$2 | ||||
|   local output_path="${KUBE_GOPATH}/bin" | ||||
|   if [[ $platform != $host_platform ]]; then | ||||
|   if [[ "$platform" != "$host_platform" ]]; then | ||||
|     output_path="${output_path}/${platform//\//_}" | ||||
|   fi | ||||
|   local bin=$(basename "${binary}") | ||||
|   | ||||
		Reference in New Issue
	
	Block a user