1
0
mirror of https://github.com/rancher/norman.git synced 2025-04-28 03:20:08 +00:00

Remove dump pkg

Remove dump.GoroutineDumpOn function. This is used nowhere in rancher or
supporting libraries, the last usage was removed from rancher/rancher in
a6712424. Cleaning up this function removes the need to update the
outdated panicparse package.
This commit is contained in:
Colleen Murphy 2023-08-10 13:55:35 -07:00
parent fb9961e3ec
commit 393a634033
3 changed files with 0 additions and 51 deletions

2
go.mod
View File

@ -5,7 +5,6 @@ go 1.19
require (
github.com/ghodss/yaml v1.0.0
github.com/gorilla/websocket v1.5.0
github.com/maruel/panicparse v0.0.0-20171209025017-c0182c169410
github.com/matryer/moq v0.3.2
github.com/pkg/errors v0.9.1
github.com/rancher/lasso v0.0.0-20221227210133-6ea88ca2fbcc
@ -42,7 +41,6 @@ require (
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/mailru/easyjson v0.7.6 // indirect
github.com/maruel/ut v1.0.0 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect

5
go.sum
View File

@ -180,7 +180,6 @@ github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxv
github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pretty v0.2.0 h1:s5hAObm+yFO5uHYt5dYjxi2rXrsnmRpJx4OYvIWUaQs=
github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
@ -190,10 +189,6 @@ github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN
github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
github.com/mailru/easyjson v0.7.6 h1:8yTIVnZgCoiM1TgqoeTl+LfU5Jg6/xL3QhGQnimLYnA=
github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
github.com/maruel/panicparse v0.0.0-20171209025017-c0182c169410 h1:1ROIrlLvFoHKX+i48KdRauq21irSOXPyfQw4T/PrINY=
github.com/maruel/panicparse v0.0.0-20171209025017-c0182c169410/go.mod h1:nty42YY5QByNC5MM7q/nj938VbgPU7avs45z6NClpxI=
github.com/maruel/ut v1.0.0 h1:Tg5f5waOijrohsOwnMlr1bZmv+wHEbuMEacNBE8kQ7k=
github.com/maruel/ut v1.0.0/go.mod h1:I68ffiAt5qre9obEVTy7S2/fj2dJku2NYLvzPuY0gqE=
github.com/matryer/moq v0.3.2 h1:z7oltmpTxiQ9nKNg0Jc7z45TM+eO7OhCVohxRxwaudM=
github.com/matryer/moq v0.3.2/go.mod h1:RJ75ZZZD71hejp39j4crZLsEDszGk6iH4v4YsWFKH4s=
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=

View File

@ -1,44 +0,0 @@
package dump
import (
"bytes"
"io"
"os"
"os/signal"
"runtime"
"github.com/maruel/panicparse/stack"
)
func GoroutineDumpOn(signals ...os.Signal) {
c := make(chan os.Signal, 1)
signal.Notify(c, signals...)
go func() {
for range c {
var (
buf []byte
stackSize int
)
bufferLen := 16384
for stackSize == len(buf) {
buf = make([]byte, bufferLen)
stackSize = runtime.Stack(buf, true)
bufferLen *= 2
}
buf = buf[:stackSize]
src := bytes.NewBuffer(buf)
if goroutines, err := stack.ParseDump(src, os.Stderr); err == nil {
buckets := stack.SortBuckets(stack.Bucketize(goroutines, stack.AnyValue))
srcLen, pkgLen := stack.CalcLengths(buckets, true)
p := &stack.Palette{}
for _, bucket := range buckets {
_, _ = io.WriteString(os.Stderr, p.BucketHeader(&bucket, true, len(buckets) > 1))
_, _ = io.WriteString(os.Stderr, p.StackLines(&bucket.Signature, srcLen, pkgLen, true))
}
_, _ = io.Copy(os.Stderr, bytes.NewBuffer(buf))
} else {
_, _ = io.Copy(os.Stderr, src)
}
}
}()
}