From b8f6b195f4560cabd11e36671d4c0712fa66b89a Mon Sep 17 00:00:00 2001 From: decentral1se Date: Thu, 11 Apr 2024 13:41:04 +0200 Subject: [PATCH] feat: hugo download with indicator --- app.go | 5 ++++- frontend/index.html | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app.go b/app.go index 62b8f7b..e7b16b4 100644 --- a/app.go +++ b/app.go @@ -3,6 +3,7 @@ package main import ( "bytes" "context" + "errors" "fmt" "io" "io/ioutil" @@ -61,7 +62,9 @@ func ensureHugoBin(homeDir string) error { hugoTarPath := filepath.Join(hugoDir, fmt.Sprintf("hugo-%s.tar.gz", hugoVersion)) url := fmt.Sprintf("https://github.com/gohugoio/hugo/releases/download/v%s/hugo_extended_%s_linux-amd64.tar.gz", hugoVersion, hugoVersion) - if _, err := os.Stat(hugoBinPath); err != nil && os.IsNotExist(err) { + if _, err := os.Stat(hugoBinPath); err == nil { + return nil + } else if errors.Is(err, os.ErrNotExist) { if err := httpGetFile(hugoTarPath, url); err != nil { return err } diff --git a/frontend/index.html b/frontend/index.html index 8a9ca36..d6f0da0 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -8,7 +8,7 @@ - -
+
+

Initialising Hugo...