all repos — homestead @ 651062cd0b3687e0ce06d63bc9de51dc59558bd0

Code for my website

run only one golangci-lint instance in pre-commit hook

Alan Pearce
commit

651062cd0b3687e0ce06d63bc9de51dc59558bd0

parent

20dd619b8605660dac67fa435d711e5f22da3174

1 file changed, 13 insertions(+), 1 deletion(-)

changed files
M flake.nixflake.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;