github.com/dominant-strategies/go-quai@v0.28.2/hooks/pre-commit (about)

     1  #!/bin/sh
     2  
     3  # Prompt for go mod tidy with default to Y (Yn)
     4  read -p "Run go mod tidy? [Yn] " run_tidy
     5  if [ -z "$run_tidy" ] || [ "$run_tidy" = "Y" ] || [ "$run_tidy" = "y" ]; then
     6    echo "Running go mod tidy..."
     7    go mod tidy
     8  else
     9    echo "Skipping go mod tidy..."
    10  fi
    11  
    12  # Prompt for lint with default to Y (Yn)
    13  read -p "Run lint? [Yn] " run_lint
    14  if [ -z "$run_lint" ] || [ "$run_lint" = "Y" ] || [ "$run_lint" = "y" ]; then
    15    echo "Running lint..."
    16    golangci-lint run
    17  else
    18    echo "Skipping lint..."
    19  fi
    20  
    21  # Prompt for tests with default to N (yN)
    22  read -p "Run tests? [yN] " run_tests
    23  if [ "$run_tests" = "Y" ] || [ "$run_tests" = "y" ]; then
    24    echo "Running tests..."
    25    go test ./...
    26  else
    27    echo "Skipping tests..."
    28  fi
    29