Skip to content

Commit

Permalink
Remove panic handling that was used to send backtraces in telemetry
Browse files Browse the repository at this point in the history
Signed-off-by: Kimmo Lehto <[email protected]>
  • Loading branch information
kke committed Apr 26, 2024
1 parent ce5933e commit 2ed9d31
Showing 1 changed file with 0 additions and 26 deletions.
26 changes: 0 additions & 26 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ package main

import (
"os"
"runtime"
"strings"

"github.com/k0sproject/k0sctl/cmd"
log "github.com/sirupsen/logrus"
Expand All @@ -14,31 +12,7 @@ import (
_ "github.com/k0sproject/k0sctl/version"
)

func handlepanic() {
if err := recover(); err != nil {
buf := make([]byte, 1<<16)
ss := runtime.Stack(buf, true)
msg := string(buf[:ss])
var bt []string
for _, row := range strings.Split(msg, "\n") {
if !strings.HasPrefix(row, "\t") {
continue
}
if strings.Contains(row, "main.") {
continue
}
if strings.Contains(row, "panic") {
continue
}
bt = append(bt, strings.TrimSpace(row))
}

log.Fatalf("PANIC: %v\n", err)
}
}

func main() {
defer handlepanic()
err := cmd.App.Run(os.Args)
if err != nil {
log.Fatal(err)
Expand Down

0 comments on commit 2ed9d31

Please sign in to comment.