-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
36 lines (31 loc) · 1.14 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
35
36
package main
import (
"embed"
"fmt"
"os"
"runtime/debug"
"github.com/multisig-labs/panopticon/commands"
"github.com/multisig-labs/panopticon/pkg/version"
)
//go:embed public/*
var content embed.FS
func panicHandler() {
if panicPayload := recover(); panicPayload != nil {
stack := string(debug.Stack())
fmt.Fprintln(os.Stderr, "================================================================================")
fmt.Fprintln(os.Stderr, " Panopticon encountered a fatal error. This is a bug!")
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)
}
}
func main() {
defer panicHandler()
commands.Execute(content)
}