From c225b603072a55f5fb2cbb7f34619f1a30a3516b Mon Sep 17 00:00:00 2001 From: Marc Khouzam Date: Thu, 26 Sep 2019 21:19:54 -0400 Subject: [PATCH] Avoid string concatenation Signed-off-by: Marc Khouzam --- cmd/helm/completion.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cmd/helm/completion.go b/cmd/helm/completion.go index 7417bc93b..7122b92be 100644 --- a/cmd/helm/completion.go +++ b/cmd/helm/completion.go @@ -16,6 +16,7 @@ limitations under the License. package main import ( + "fmt" "io" "os" "path/filepath" @@ -88,12 +89,12 @@ func runCompletionBash(out io.Writer, cmd *cobra.Command) error { # to the helm completion function to handle the case where # the user renamed the helm binary if [[ $(type -t compopt) = "builtin" ]]; then - complete -o default -F __start_helm ` + binary + ` + complete -o default -F __start_helm %[1]s else - complete -o default -o nospace -F __start_helm ` + binary + ` + complete -o default -o nospace -F __start_helm %[1]s fi ` - out.Write([]byte(renamedBinaryHook)) + fmt.Fprintf(out, renamedBinaryHook, binary) } return err