fix: throw an error on panic. (#1540)

* fix: throw an error on panic.
* current min go version is go1.13
This commit is contained in:
Ludovic Fernandez 2020-12-12 21:31:17 +01:00 committed by GitHub
parent 10c786e52a
commit b79e0c5adf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

2
go.mod
View File

@ -1,6 +1,6 @@
module github.com/golangci/golangci-lint
go 1.12
go 1.13
require (
4d63.com/gochecknoglobals v0.0.0-20201008074935-acfc0b28355a

View File

@ -91,6 +91,8 @@ func (r *Runner) runLinterSafe(ctx context.Context, lintCtx *linter.Context,
defer func() {
if panicData := recover(); panicData != nil {
if pe, ok := panicData.(*errorutil.PanicError); ok {
err = fmt.Errorf("%s: %w", lc.Name(), pe)
// Don't print stacktrace from goroutines twice
lintCtx.Log.Warnf("Panic: %s: %s", pe, pe.Stack())
} else {