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>
Signed-off-by: Vitaly Zhuravlev <v-zhuravlev@users.noreply.github.com>
  • Loading branch information
SuperQ authored and v-zhuravlev committed Nov 1, 2024
1 parent 8cf91ed commit f36b602
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 f36b602

Please sign in to comment.