Add linter rule to guard against use of os.Is* error functions

Signed-off-by: Curd Becker <me@curd-becker.de>
This commit is contained in:
Curd Becker
2025-12-09 03:29:44 +01:00
parent 536e183451
commit 58d24d2dfb

View File

@@ -37,6 +37,12 @@ linters:
# going to be tricked into overwriting host files.
- pattern: ^os\.Create$
pkg: ^os$
# os.Is* error checking functions predate errors.Is. Therefore, they
# only support errors returned by the os package and subtly fail
# to deal with other wrapped error types.
# New code should use errors.Is(err, error-type) instead.
- pattern: ^os\.Is(Exist|NotExist|Permission|Timeout)$
pkg: ^os$
analyze-types: true
exclusions:
rules: