-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmain.go
34 lines (30 loc) · 1.21 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package main
import (
"fmt"
"os"
"runtime/debug"
"github.com/multisig-labs/gogotools/cmd"
"github.com/multisig-labs/gogotools/pkg/version"
)
func main() {
defer panicHandler()
cmd.Execute()
}
func panicHandler() {
if panicPayload := recover(); panicPayload != nil {
stack := string(debug.Stack())
fmt.Fprintln(os.Stderr, "================================================================================")
fmt.Fprintln(os.Stderr, " Fatal error. Sorry! You found a bug.")
fmt.Fprintln(os.Stderr, " Please copy all of this info into an issue at")
fmt.Fprintln(os.Stderr, " https://github.com/multisig-labs/gogotools")
fmt.Fprintln(os.Stderr, "================================================================================")
fmt.Fprintf(os.Stderr, "Version: %s\n", version.Version)
fmt.Fprintf(os.Stderr, "Build Date: %s\n", version.BuildDate)
fmt.Fprintf(os.Stderr, "Git Commit: %s\n", version.GitCommit)
fmt.Fprintf(os.Stderr, "Go Version: %s\n", version.GoVersion)
fmt.Fprintf(os.Stderr, "OS / Arch: %s\n", version.OsArch)
fmt.Fprintf(os.Stderr, "Panic: %s\n\n", panicPayload)
fmt.Fprintln(os.Stderr, stack)
os.Exit(1)
}
}