fix(bootstrap): Hugo init with go install 72/41472/1
authorpmikus <[email protected]>
Fri, 23 Aug 2024 07:49:41 +0000 (09:49 +0200)
committerpmikus <[email protected]>
Fri, 23 Aug 2024 08:00:56 +0000 (10:00 +0200)
Signed-off-by: Peter Mikus <[email protected]>
Change-Id: Iadd4851ab4a7fc366ddffbace6ce7b47776fceeb

resources/libraries/bash/function/hugo.sh

index ba5591b..6c201d9 100644 (file)
@@ -26,12 +26,12 @@ function go_install () {
         aarch64) architecture="arm64" ;;
     esac
 
-    go_version="go1.20.2.linux-${architecture}.tar.gz"
+    go_version="go1.22.5.linux-${architecture}.tar.gz"
     go_url="https://go.dev/dl"
     wget "${go_url}/${go_version}"
     rm -rf "/usr/local/go"
-    tar -C "/usr/local" -xzf "go1.20.2.linux-${architecture}.tar.gz"
-    rm "go1.20.2.linux-${architecture}.tar.gz"
+    tar -C "/usr/local" -xzf "go1.22.5.linux-${architecture}.tar.gz"
+    rm "go1.22.5.linux-${architecture}.tar.gz"
     export PATH=$PATH:/usr/local/go/bin
 }
 
@@ -45,6 +45,10 @@ function hugo_build_site () {
     # Functions called:
     # - die - Print to stderr and exit.
 
+    if ! install go; then
+        go_install || die "Please install Go!"
+    fi
+
     if ! installed hugo; then
         hugo_install || die "Please install Hugo!"
     fi
@@ -64,6 +68,10 @@ function hugo_init_modules () {
     # Functions called:
     # - die - Print to stderr and exit.
 
+    if ! install go; then
+        go_install || die "Please install Go!"
+    fi
+
     if ! installed hugo; then
         hugo_install || die "Please install Hugo!"
     fi