From 841f6500b5407395f7bb46c0ca30b36b918c714c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Mon, 3 Jun 2024 12:02:17 +0200 Subject: [PATCH] helpers/go: add double quotes to trigger syntax errors when bugs occur instead of silently behaving incorrectly. --- helpers/helpers.v1.d/go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/helpers/helpers.v1.d/go b/helpers/helpers.v1.d/go index 0da4277b5..886123071 100644 --- a/helpers/helpers.v1.d/go +++ b/helpers/helpers.v1.d/go @@ -154,12 +154,12 @@ ynh_install_go () { test -x /usr/bin/go_goenv && mv /usr/bin/go_goenv /usr/bin/go # Install the requested version of Go - local final_go_version=$(goenv latest --print $go_version) + local final_go_version=$(goenv latest --print "$go_version") ynh_print_info --message="Installation of Go-$final_go_version" - goenv install --skip-existing $final_go_version + goenv install --skip-existing "$final_go_version" # Store go_version into the config of this app - ynh_app_setting_set --app=$YNH_APP_INSTANCE_NAME --key=go_version --value=$final_go_version + ynh_app_setting_set --app="$YNH_APP_INSTANCE_NAME" --key="go_version" --value="$final_go_version" # Cleanup Go versions ynh_cleanup_go @@ -181,7 +181,7 @@ eval \"\$(goenv init -)\" # # usage: ynh_remove_go ynh_remove_go () { - local go_version=$(ynh_app_setting_get --app=$YNH_APP_INSTANCE_NAME --key=go_version) + local go_version=$(ynh_app_setting_get --app="$YNH_APP_INSTANCE_NAME" --key="go_version") # Load goenv path in PATH local CLEAR_PATH="$goenv_install_dir/bin:$PATH" @@ -190,7 +190,7 @@ ynh_remove_go () { PATH=$(echo $CLEAR_PATH | sed 's@/usr/local/bin:@@') # Remove the line for this app - ynh_app_setting_delete --app=$YNH_APP_INSTANCE_NAME --key=go_version + ynh_app_setting_delete --app="$YNH_APP_INSTANCE_NAME" --key="go_version" # Cleanup Go versions ynh_cleanup_go @@ -224,7 +224,7 @@ ynh_cleanup_go () { if ! `echo ${required_go_versions} | grep "${installed_go_version}" 1>/dev/null 2>&1` then ynh_print_info --message="Removing of Go-$installed_go_version" - $goenv_install_dir/bin/goenv uninstall --force $installed_go_version + $goenv_install_dir/bin/goenv uninstall --force "$installed_go_version" fi done