runner: non-zero exit code when a linter produces a panic (#1979)
Some checks failed
Extra / Vulnerability scanner (push) Has been cancelled
CI / go-mod (push) Has been cancelled
CI / golangci-lint (push) Has been cancelled
Release a tag / release (push) Has been cancelled
CI / tests-on-windows (push) Has been cancelled
CI / tests-on-macos (push) Has been cancelled
CI / tests-on-unix (1.15) (push) Has been cancelled
CI / tests-on-unix (1.16) (push) Has been cancelled
CI / check_generated (push) Has been cancelled
Release a tag / docker-release (map[Dockerfile:build/Dockerfile.alpine]) (push) Has been cancelled
Release a tag / docker-release (map[Dockerfile:build/Dockerfile]) (push) Has been cancelled

This commit is contained in:
Ludovic Fernandez 2021-05-13 23:49:08 +02:00 committed by GitHub
parent 589c49efea
commit 625445b1f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -108,10 +108,10 @@ func (r *Runner) runLinterSafe(ctx context.Context, lintCtx *linter.Context,
err = fmt.Errorf("%s: %w", lc.Name(), pe)
// Don't print stacktrace from goroutines twice
lintCtx.Log.Warnf("Panic: %s: %s", pe, pe.Stack())
r.Log.Errorf("Panic: %s: %s", pe, pe.Stack())
} else {
err = fmt.Errorf("panic occurred: %s", panicData)
r.Log.Warnf("Panic stack trace: %s", debug.Stack())
r.Log.Errorf("Panic stack trace: %s", debug.Stack())
}
}
}()