-
Notifications
You must be signed in to change notification settings - Fork 169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
golangci-lint fails because it cannot find go
in $PATH
#464
Comments
still failing :( |
same issue here using $ nix develop .#git-hooks --ignore-environment I get into an env that has go, but I'm fairly certain it's from the previous shell using $ nix develop .#git-hooks --unset PATH I can no longer use for reference, the devShells.git-hooks = config.pre-commit.devShell; |
using golangci-lint = {
enable = true;
extraPackages = [ pkgs.go pkgs.which ];
}; I get the $ which go
/nix/store/jyhpd4hgq672bm4m4s1r25zm1bx8vd44-go-1.23.2/bin/go but |
I ended up writing a custom hook for all go tools, since I also needed to run some codegen before running golangci-lint x-pre-commit-go =
let
pkg = pkgs.writeShellApplication {
name = "x-pre-commit-go";
runtimeInputs = [
pkgs.flatbuffers
pkgs.go
pkgs.golangci-lint
pkgs.just
pkgs.jq
pkgs.protobuf
pkgs.protoc-gen-go
pkgs.protoc-gen-go-grpc
pkgs.revive
];
text = ''
just gen-go
just golangci-lint
# just go-test
# just go-vet
# just go-revive
# just go-staticcheck
'';
};
in
{
enable = true;
package = pkg;
entry = "${lib.getExe pkg}";
pass_filenames = false;
}; I'm using @shackra maybe this will be useful to you too |
This happens when running
nix flake check
.This may be related to the fact that flakes do not admit environment variables. It goes well as a pre-commit-hook, thought.The text was updated successfully, but these errors were encountered: