diff --git a/pre-commit.sh b/pre-commit.sh new file mode 100755 index 0000000..603b2ad --- /dev/null +++ b/pre-commit.sh @@ -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 diff --git a/shell.nix b/shell.nix index 2db1ebe..7693d99 100644 --- a/shell.nix +++ b/shell.nix @@ -1,5 +1,4 @@ { pkgs ? import {} }: 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 ]; }