From 417e61d8d9f7d5d6e7297a63e7a25b732e8559af Mon Sep 17 00:00:00 2001 From: Jayson Grace Date: Tue, 25 Jun 2024 10:51:18 -0600 Subject: [PATCH] Remove flaky go-licenses pre-commit hook --- .hooks/go-licenses.sh | 43 ----------------------------------------- .pre-commit-config.yaml | 5 ----- 2 files changed, 48 deletions(-) delete mode 100755 .hooks/go-licenses.sh diff --git a/.hooks/go-licenses.sh b/.hooks/go-licenses.sh deleted file mode 100755 index 030e62bf..00000000 --- a/.hooks/go-licenses.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash - -# Function to check if go mod vendor should run or not -run_vendor() { - echo "Running go mod vendor..." - go mod vendor -} - -# Function to check licenses -check_licenses() { - action=$1 - - go install github.com/google/go-licenses@latest - - # Decide action based on input - if [[ $action == "check_forbidden" ]]; then - echo "Checking for forbidden licenses..." - output=$(go-licenses check ./... 2> /dev/null) - if [[ "${output}" == *"ERROR: forbidden license found"* ]]; then - echo "Forbidden licenses found. Please remove them." - exit 1 - else - echo "No forbidden licenses found." - fi - elif [[ $action == "output_csv" ]]; then - echo "Outputting licenses to csv..." - status=go-licenses csv ./... 2> /dev/null - elif [[ $action == "vendor" ]]; then - echo "Vendoring dependencies..." - run_vendor - fi -} - -# Ensure input is provided -if [[ $# -lt 1 ]]; then - echo "Incorrect number of arguments." - echo "Usage: $0 " - echo "Example: $0 check_forbidden" - exit 1 -fi - -# Run checks -check_licenses "${1}" diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 00807b34..dadee1af 100755 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -44,11 +44,6 @@ repos: require_serial: true log_file: /tmp/go-vet.log - - id: go-licenses - name: Run go-licenses - language: script - entry: .hooks/go-licenses.sh check_forbidden - - id: go-copyright name: Ensure all go files have the copyright header language: script