From ee0c02a5f3dd1f2e4f9a61ae5a8a8d300eec7d57 Mon Sep 17 00:00:00 2001 From: becivells <732903873@qq.com> Date: Tue, 28 Dec 2021 14:35:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E7=89=88=E6=9C=AC=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E8=A7=A3=E5=86=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/cli/parser.go | 10 +++++----- internal/cli/update.go | 7 ++----- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/internal/cli/parser.go b/internal/cli/parser.go index 8fc47d6..88e0212 100644 --- a/internal/cli/parser.go +++ b/internal/cli/parser.go @@ -3,10 +3,6 @@ package cli import ( "errors" "fmt" - "fofax/internal/fx" - "fofax/internal/fxparser" - "fofax/internal/printer" - "fofax/internal/utils" "io/ioutil" "math/rand" "os" @@ -14,7 +10,11 @@ import ( "strings" "time" + "fofax/internal/fx" + "fofax/internal/fxparser" "fofax/internal/goflags" + "fofax/internal/printer" + "fofax/internal/utils" ) const ( @@ -336,7 +336,7 @@ func checkUpdateInfo() { if -time.Until(lastime) > 24*time.Hour { err := UpdateTips(FoFaXVersion) if err != nil { - printer.Infof(err.Error()) + printer.Info(err.Error()) } ioutil.WriteFile(lastfile, []byte(time.Now().Format("2006-01-02T15:04:05Z")), os.ModePerm) } diff --git a/internal/cli/update.go b/internal/cli/update.go index fdc5c60..09594a5 100644 --- a/internal/cli/update.go +++ b/internal/cli/update.go @@ -10,10 +10,7 @@ import ( ) func UpdateTips(tagName string) error { - if !strings.HasPrefix(tagName, "v") { - return fmt.Errorf("%s", "this file does not have a version number") - } - + tagName = fmt.Sprintf("v%s", tagName) if strings.HasSuffix(tagName, "-next") { printer.Debug("Self-compiled versions do not check for updates") return nil @@ -33,7 +30,7 @@ func UpdateTips(tagName string) error { if err != nil { return err } - + printer.Debugf("github current version: %s\n", gVersion) if gVersion.GreaterThan(bVersion) { bannerSite(fmt.Sprintf("New:\n\nVersion:%s\n\n%s\n", gtag, ginfo)) bannerSite("Please go to https://github.com/xiecat/fofax/releases to download\n\n")