MCPcopy Create free account
hub / github.com/maruel/panicparse / main

Function main

cmd/panic/main.go:47–85  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

45)
46
47func main() {
48 if len(os.Args) == 2 {
49 switch n := os.Args[1]; n {
50 case "-h", "-help", "--help", "help":
51 usage()
52 os.Exit(0)
53
54 case "dump_commands":
55 // Undocumented command to do a raw dump of the supported commands. This
56 // is used by unit tests in ../../stack.
57 items := make([]string, 0, len(types))
58 for n := range types {
59 items = append(items, n)
60 }
61 sort.Strings(items)
62 for _, n := range items {
63 fmt.Printf("%s\n", n)
64 }
65 os.Exit(0)
66
67 default:
68 if f, ok := types[n]; ok {
69 fmt.Printf("GOTRACEBACK=%s\n", os.Getenv("GOTRACEBACK"))
70 if n == "simple" {
71 // Since the map lookup creates another call stack entry, add a
72 // one-off "simple" panic style to test the very minimal case.
73 // types["simple"].f is never called.
74 panic("simple")
75 }
76 f.f()
77 os.Exit(3)
78 }
79 fmt.Fprintf(stdErr, "unknown panic style %q\n", n)
80 os.Exit(1)
81 }
82 }
83 usage()
84 os.Exit(1)
85}
86
87// Mocked in test.
88var stdErr io.Writer = os.Stderr

Callers

nothing calls this directly

Calls 1

usageFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…