chore(style): convert blocks into functions (see #325)
[webi-installers/.git] / golang / install.sh
index 4530dfa063a52f8472cf3a2372a3e1e850f7d853..2df6a91274c2b4a218b0822a6458039dc0d8e882 100644 (file)
@@ -15,7 +15,7 @@ pkg_cmd_name="go"
 #
 # Their defaults are defined in _webi/template.sh at https://github.com/webinstall/packages
 
-pkg_get_current_version() {
+function pkg_get_current_version() {
     # 'go version' has output in this format:
     #       go version go1.14.2 darwin/amd64
     # This trims it down to just the version number:
@@ -26,13 +26,13 @@ pkg_get_current_version() {
         sed 's:go::'
 }
 
-pkg_format_cmd_version() {
+function pkg_format_cmd_version() {
     # 'go v1.14.0' will be 'go1.14'
     my_version=$(echo "$1" | sed 's:\.0::g')
     echo "${pkg_cmd_name}${my_version}"
 }
 
-pkg_link() {
+function pkg_link() {
     # 'pkg_dst' will default to $HOME/.local/opt/go
     # 'pkg_src' will be the installed version, such as to $HOME/.local/opt/go-v1.14.2
     rm -rf "$pkg_dst"
@@ -47,7 +47,7 @@ pkg_link() {
     ln -s "$GOBIN_REAL" "$GOBIN"
 }
 
-pkg_post_install() {
+function pkg_post_install() {
     pkg_link
 
     # web_path_add is defined in _webi/template.sh at https://github.com/webinstall/packages
@@ -108,7 +108,7 @@ pkg_post_install() {
     echo ""
 }
 
-pkg_done_message() {
+function pkg_done_message() {
     echo "Installed 'go v$WEBI_VERSION' to ~/.local/opt/go"
     # note: literal $HOME on purpose
     #shellcheck disable=SC2016