Skip to content

Commit b79e0c5

Browse files
authored
fix: throw an error on panic. (#1540)
* fix: throw an error on panic. * current min go version is go1.13
1 parent 10c786e commit b79e0c5

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/golangci/golangci-lint
22

3-
go 1.12
3+
go 1.13
44

55
require (
66
4d63.com/gochecknoglobals v0.0.0-20201008074935-acfc0b28355a

pkg/lint/runner.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ func (r *Runner) runLinterSafe(ctx context.Context, lintCtx *linter.Context,
9191
defer func() {
9292
if panicData := recover(); panicData != nil {
9393
if pe, ok := panicData.(*errorutil.PanicError); ok {
94+
err = fmt.Errorf("%s: %w", lc.Name(), pe)
95+
9496
// Don't print stacktrace from goroutines twice
9597
lintCtx.Log.Warnf("Panic: %s: %s", pe, pe.Stack())
9698
} else {

0 commit comments

Comments
 (0)