run only one golangci-lint instance in pre-commit hook
1 file changed, 13 insertions(+), 1 deletion(-)
changed files
M flake.nix → flake.nix
@@ -92,7 +92,19 @@ entry = "${pkgs.go}/bin/go mod tidy"; pass_filenames = false; }; golines.enable = true; - golangci-lint.enable = true; + golangci-lint = { + enable = true; + entry = + let + hookPkgs = pre-commit-hooks.packages.${system}; + script = pkgs.writeShellScript "precommit-golangci-lint" '' + set -e + echo "$@" | xargs -n1 dirname | sort -u | xargs -n1 printf '"./%s" ' | \ + xargs ${hookPkgs.golangci-lint}/bin/golangci-lint run --new --fix + ''; + in + builtins.toString script; + }; gotest.enable = true; gomod2nix = { enable = true;