From b2b552749de5d08252b8929fdf5ddc4efea2f930 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Tue, 19 May 2026 11:27:49 -0700 Subject: [PATCH] ci: rm contrib/cirrus/check_go_changes.sh This functionality is superseded by golangci-lint. Signed-off-by: Kir Kolyshkin --- contrib/cirrus/check_go_changes.sh | 63 ------------------------------ contrib/cirrus/postbuild.sh | 4 -- 2 files changed, 67 deletions(-) delete mode 100755 contrib/cirrus/check_go_changes.sh diff --git a/contrib/cirrus/check_go_changes.sh b/contrib/cirrus/check_go_changes.sh deleted file mode 100755 index 6d1c8e576a..0000000000 --- a/contrib/cirrus/check_go_changes.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/bash - -set -eo pipefail - -# This script is intended to confirm new go code conforms to certain -# conventions and/or does not introduce use of old/deprecated packages -# or functions. It needs to run in the Cirrus CI environment, on behalf -# of PRs, via runner.sh. This ensures a consistent and predictable -# environment not easily reproduced by a `Makefile`. - -# shellcheck source=contrib/cirrus/lib.sh -source $(dirname $0)/lib.sh - -check_msg() { - msg "#####" # Cirrus-CI logs automatically squash empty lines - msg "##### $1" # Complains if $1 is empty -} - -# First arg is check description, second is regex to search $diffs for. -check_diffs() { - local check regex - check="$1" - regex="$2" - check_msg "Confirming changes have no $check" - req_env_vars check regex diffs - if grep -E -q "$regex"<<<"$diffs"; then - # Show 5 context lines before/after as compromise for script simplicity - die "Found $check: -$(grep -E -B 5 -A 5 "$regex"<<<"$diffs")" - fi -} - -# Defined by Cirrus-CI -# shellcheck disable=SC2154 -if [[ "$CIRRUS_BRANCH" =~ pull ]]; then - for var in CIRRUS_CHANGE_IN_REPO CIRRUS_PR DEST_BRANCH; do - if [[ -z "${!var}" ]]; then - warn "Skipping: Golang code checks require non-empty '\$$var'" - exit 0 - fi - done -else - warn "Skipping: Golang code checks in tag and branch contexts" - exit 0 -fi - -# Defined by/in Cirrus-CI config. -# shellcheck disable=SC2154 -base=$(git merge-base $DEST_BRANCH $CIRRUS_CHANGE_IN_REPO) -diffs=$(git diff $base $CIRRUS_CHANGE_IN_REPO -- '*.go' ':^vendor/' ':^test/tools/vendor/') - -if [[ -z "$diffs" ]]; then - check_msg "There are no golang diffs to check between $base...$CIRRUS_CHANGE_IN_REPO" - exit 0 -fi - -check_diffs \ - "use of deprecated ioutil vs recommended io or os packages." \ - "^(\\+[^#]+io/ioutil)|(\\+.+ioutil\\..+)" - -check_diffs \ - "use of os.IsNotExist(err) vs recommended errors.Is(err, fs.ErrNotExist)" \ - "^\\+[^#]*os\\.IsNotExist\\(" diff --git a/contrib/cirrus/postbuild.sh b/contrib/cirrus/postbuild.sh index 2beaf0f893..52e840d3c6 100755 --- a/contrib/cirrus/postbuild.sh +++ b/contrib/cirrus/postbuild.sh @@ -40,7 +40,3 @@ SUGGESTION="run 'make vendor', 'make -C test/tools vendor' and 'make completions showrun make generate-bindings SUGGESTION="run 'make generate-bindings' and commit all changes" ./hack/tree_status.sh - -# Defined in Cirrus-CI config. -# shellcheck disable=SC2154 -$SCRIPT_BASE/check_go_changes.sh