From bbe919be3b2c97306e56be57f73485fb38416c48 Mon Sep 17 00:00:00 2001 From: Seednode Date: Sat, 10 Sep 2022 16:35:05 -0500 Subject: [PATCH] Removed unused utils.go --- cmd/root.go | 5 ++--- cmd/utils.go | 20 -------------------- cmd/version.go | 2 +- cmd/web.go | 2 -- 4 files changed, 3 insertions(+), 26 deletions(-) delete mode 100644 cmd/utils.go diff --git a/cmd/root.go b/cmd/root.go index 82f84d2..5320fc9 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -5,7 +5,7 @@ Copyright © 2022 Seednode package cmd import ( - "fmt" + "os" "github.com/spf13/cobra" ) @@ -27,8 +27,7 @@ var rootCmd = &cobra.Command{ func Execute() { err := rootCmd.Execute() if err != nil { - fmt.Println(err) - panic(Exit{1}) + os.Exit(1) } } diff --git a/cmd/utils.go b/cmd/utils.go deleted file mode 100644 index 46cad71..0000000 --- a/cmd/utils.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright © 2022 Seednode -*/ - -package cmd - -import ( - "os" -) - -type Exit struct{ Code int } - -func HandleExit() { - if e := recover(); e != nil { - if exit, ok := e.(Exit); ok == true { - os.Exit(exit.Code) - } - panic(e) - } -} diff --git a/cmd/version.go b/cmd/version.go index 027b143..6a2b188 100644 --- a/cmd/version.go +++ b/cmd/version.go @@ -10,7 +10,7 @@ import ( "github.com/spf13/cobra" ) -var Version = "0.4.0" +var Version = "0.4.1" func init() { rootCmd.AddCommand(versionCmd) diff --git a/cmd/web.go b/cmd/web.go index fb036a6..68f9917 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -123,8 +123,6 @@ func servePageHandler(paths []string) http.HandlerFunc { func doNothing(http.ResponseWriter, *http.Request) {} func ServePage(args []string) { - defer HandleExit() - paths, err := normalizePaths(args) if err != nil { log.Fatal(err)