github.com/dominant-strategies/go-quai@v0.28.2/hooks/install-hooks.sh (about) 1 #!/bin/bash 2 3 # Change to the root directory of your project 4 cd $(git rev-parse --show-toplevel) 5 6 # Symlink the pre-commit hook 7 ln -sf $(pwd)/hooks/pre-commit .git/hooks/pre-commit 8 9 # Detect the operating system 10 OS="$(uname)" 11 12 # Check if golangci-lint is installed, and install it if necessary 13 if ! command -v golangci-lint >/dev/null 2>&1; then 14 echo "golangci-lint not found. Installing..." 15 16 case $OS in 17 Linux) 18 # binary will be $(go env GOPATH)/bin/golangci-lint 19 curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.52.2 20 ;; 21 Darwin) 22 # Install or upgrade golangci-lint for macOS 23 if brew ls --versions golangci-lint >/dev/null; then 24 brew upgrade golangci-lint 25 else 26 brew install golangci-lint 27 fi 28 ;; 29 *) 30 echo "Unsupported OS: $OS" 31 exit 1 32 ;; 33 esac 34 fi 35 36 echo "Setup complete." 37