Removed unused utils.go

This commit is contained in:
Seednode 2022-09-10 16:35:05 -05:00
parent 469cb96883
commit bbe919be3b
4 changed files with 3 additions and 26 deletions

View File

@ -5,7 +5,7 @@ Copyright © 2022 Seednode <seednode@seedno.de>
package cmd package cmd
import ( import (
"fmt" "os"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
@ -27,8 +27,7 @@ var rootCmd = &cobra.Command{
func Execute() { func Execute() {
err := rootCmd.Execute() err := rootCmd.Execute()
if err != nil { if err != nil {
fmt.Println(err) os.Exit(1)
panic(Exit{1})
} }
} }

View File

@ -1,20 +0,0 @@
/*
Copyright © 2022 Seednode <seednode@seedno.de>
*/
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)
}
}

View File

@ -10,7 +10,7 @@ import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
var Version = "0.4.0" var Version = "0.4.1"
func init() { func init() {
rootCmd.AddCommand(versionCmd) rootCmd.AddCommand(versionCmd)

View File

@ -123,8 +123,6 @@ func servePageHandler(paths []string) http.HandlerFunc {
func doNothing(http.ResponseWriter, *http.Request) {} func doNothing(http.ResponseWriter, *http.Request) {}
func ServePage(args []string) { func ServePage(args []string) {
defer HandleExit()
paths, err := normalizePaths(args) paths, err := normalizePaths(args)
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)