From 9594085573f58ef2f1adbaede2744ab72f94ff09 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Tue, 16 Feb 2021 12:43:09 -0800 Subject: [PATCH] script/validate-gofmt: rm Add gofmt to golangci-lint configuration, and remove the script which ran gofmt. Signed-off-by: Kir Kolyshkin --- .golangci.yml | 4 ++++ Makefile | 1 - script/validate-gofmt | 30 ------------------------------ 3 files changed, 4 insertions(+), 31 deletions(-) delete mode 100755 script/validate-gofmt diff --git a/.golangci.yml b/.golangci.yml index c9f461e8f..d2cd076f5 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -3,3 +3,7 @@ run: build-tags: - seccomp + +linters: + enable: + - gofmt diff --git a/Makefile b/Makefile index e13d8f1d4..7b8f502f4 100644 --- a/Makefile +++ b/Makefile @@ -118,7 +118,6 @@ clean: rm -rf man/man8 validate: - script/validate-gofmt script/validate-c $(GO) vet $(MOD_VENDOR) ./... diff --git a/script/validate-gofmt b/script/validate-gofmt deleted file mode 100755 index 8337ed2da..000000000 --- a/script/validate-gofmt +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash - -source "$(dirname "$BASH_SOURCE")/.validate" - -IFS=$'\n' -files=($(validate_diff --diff-filter=ACMR --name-only -- '*.go' | grep -v '^vendor/' || true)) -unset IFS - -badFiles=() -for f in "${files[@]}"; do - # we use "git show" here to validate that what's committed is formatted - if [ "$(git show "$VALIDATE_HEAD:$f" | gofmt -s -l)" ]; then - badFiles+=("$f") - fi -done - -if [ ${#badFiles[@]} -eq 0 ]; then - echo 'Congratulations! All Go source files are properly formatted.' -else - { - echo "These files are not properly gofmt'd:" - for f in "${badFiles[@]}"; do - echo " - $f" - done - echo - echo 'Please reformat the above files using "gofmt -s -w" and commit the result.' - echo - } >&2 - false -fi