Skip to content

Commit

Permalink
Enforce no subprocess policy (prometheus#2926)
Browse files Browse the repository at this point in the history
Add depguard to golangci-lint to enforce the no-os/exec policy.

Signed-off-by: Ben Kochie <superq@gmail.com>
  • Loading branch information
SuperQ authored and gitperr committed Apr 30, 2024
1 parent 554a546 commit 1698bab
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
linters:
enable:
- depguard
- misspell
- revive
disable:
Expand All @@ -19,6 +20,14 @@ issues:
- errcheck

linters-settings:
depguard:
rules:
no_exec_policy:
files:
- "!$test"
deny:
- pkg: "os/exec"
desc: "Using os/exec to run sub processes it not allowed by policy"
errcheck:
exclude-functions:
# Used in HTTP handlers, any error is handled by the server itself.
Expand Down

0 comments on commit 1698bab

Please sign in to comment.