Add golangci-lint

This commit is contained in:
bad 2021-10-17 20:39:16 +02:00
parent a4b5af256d
commit beb045efb5
2 changed files with 18 additions and 2 deletions

17
pre-commit.sh Executable file
View file

@ -0,0 +1,17 @@
#!/usr/bin/env bash
# stolen from somewhere idk where tho tbh
GOPATH="${GOPATH:-"$HOME/go"}"
PATH="$PATH:$GOPATH/bin/"
# Check for golangci-lint
if [[ ! "which golangci-lint 2>&1 > /dev/null" ]]; then
printf "\t\033[41mPlease install golangci-lint\033"
exit 1
fi
golangci-lint run --fix --new-from-rev HEAD ./...
exit 0

View file

@ -1,5 +1,4 @@
{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell {
# nativeBuildInputs is usually what you want -- tools you need to run
nativeBuildInputs = with pkgs; [ (enableDebugging mosquitto) wireshark delve ];
nativeBuildInputs = with pkgs; [ go golangci-lint (enableDebugging mosquitto) wireshark delve ];
}