From acc2df9107e6531529460c7a77da07166d2d45bb Mon Sep 17 00:00:00 2001 From: Ryo Nihei Date: Fri, 13 May 2022 01:26:20 +0900 Subject: Stop handling panic to print a stack trace --- cmd/vartan/compile.go | 21 --------------------- 1 file changed, 21 deletions(-) (limited to 'cmd/vartan/compile.go') diff --git a/cmd/vartan/compile.go b/cmd/vartan/compile.go index 70d01b2..e2b5f56 100644 --- a/cmd/vartan/compile.go +++ b/cmd/vartan/compile.go @@ -6,7 +6,6 @@ import ( "io/ioutil" "os" "path/filepath" - "runtime/debug" "strings" verr "github.com/nihei9/vartan/error" @@ -47,20 +46,6 @@ func runCompile(cmd *cobra.Command, args []string) (retErr error) { grmPath = args[0] } defer func() { - panicked := false - v := recover() - if v != nil { - err, ok := v.(error) - if !ok { - retErr = fmt.Errorf("an unexpected error occurred: %v", v) - fmt.Fprintf(os.Stderr, "%v:\n%v", retErr, string(debug.Stack())) - return - } - - retErr = err - panicked = true - } - if retErr != nil { specErrs, ok := retErr.(verr.SpecErrors) if ok { @@ -74,12 +59,6 @@ func runCompile(cmd *cobra.Command, args []string) (retErr error) { } } } - - if panicked { - fmt.Fprintf(os.Stderr, "%v:\n%v", retErr, string(debug.Stack())) - } else { - fmt.Fprintf(os.Stderr, "%v\n", retErr) - } } }() -- cgit v1.2.3