From a49b2391febc6606b1f271a60cdf52c0c6c69972 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20K=C3=BCndig?= Date: Tue, 30 Sep 2025 16:54:19 +0200 Subject: [PATCH] Added hooks.golangci-lint.settings.flags option --- modules/hooks.nix | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/modules/hooks.nix b/modules/hooks.nix index 6c0425c1..eeca3afe 100644 --- a/modules/hooks.nix +++ b/modules/hooks.nix @@ -639,6 +639,20 @@ in }; }; }; + golangci-lint = mkOption { + description = "golangci-lint hook"; + type = types.submodule { + imports = [ hookModule ]; + options.settings = { + flags = mkOption { + type = types.str; + description = "Flags passed to golangci-lint run command. See all available [here](https://golangci-lint.run/docs/configuration/cli/#run)"; + default = ""; + example = "--fix"; + }; + }; + }; + }; golines = mkOption { description = "golines hook"; type = types.submodule { @@ -2938,7 +2952,7 @@ lib.escapeShellArgs (lib.concatMap (ext: [ "--ghc-opt" "-X${ext}" ]) hooks.fourm script = pkgs.writeShellScript "precommit-golangci-lint" '' set -e for dir in $(echo "$@" | xargs -n1 dirname | sort -u); do - ${hooks.golangci-lint.package}/bin/golangci-lint run ./"$dir" + ${hooks.golangci-lint.package}/bin/golangci-lint run ${hooks.golangci-lint.settings.flags} ./"$dir" done ''; in