diff options
author | Robin Jarry <robin@jarry.cc> | 2023-01-05 12:16:34 +0100 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2023-01-06 23:51:52 +0100 |
commit | 175c1c822084d0f42892729c8e095397bd830966 (patch) | |
tree | 332ef46037e29509eb5ee9466ec2e0e2e12e2ee3 /.golangci.toml | |
parent | 10b995f0196c8243132c3f435d4e11b3c9700e35 (diff) | |
download | aerc-175c1c822084d0f42892729c8e095397bd830966.tar.gz |
contrib: add linter to check for panic handler in goroutines
If log.PanicHandler() is not installed in a goroutine and a panic
occurs, the terminal state is not restored. This causes the panic trace
to be unreadable since the terminal is broken.
Add a custom analyzer that parses our code and ensures that:
defer log.PanicHandler()
is the first statement of all functions that are executed in goroutines.
Include that linter in golangci config.
Signed-off-by: Robin Jarry <robin@jarry.cc>
Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
Diffstat (limited to '.golangci.toml')
-rw-r--r-- | .golangci.toml | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/.golangci.toml b/.golangci.toml index 97c1f7fb..74cd03bb 100644 --- a/.golangci.toml +++ b/.golangci.toml @@ -11,9 +11,15 @@ enable = [ "errorlint", # check to ensure no problems with wrapped errors "gocritic", # check for bugs, performance, and style issues "gofmt", # check that gofmt is satisfied + "aerc", # aerc specific linters ] [linters-settings.nolintlint] allow-unused = false # don't allow nolint if not required require-explanation = true # require an explanation when disabling a linter requre-specific = true # linter exceptions must specify the linter + +[linters-settings.custom.aerc] +path = "./linters.so" +description = "Aerc specific linters" +original-url = "git.sr.ht/~rjarry/aerc/contrib" |