From 0974500c9023765470f8095d16d83ba2b0c494a1 Mon Sep 17 00:00:00 2001 From: John Chadwick Date: Wed, 21 Feb 2024 13:47:03 -0500 Subject: [PATCH 1/3] Use xargs to avoid long argument lists --- make/go/go.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/make/go/go.mk b/make/go/go.mk index 64ebd49..48f849c 100644 --- a/make/go/go.mk +++ b/make/go/go.mk @@ -84,14 +84,14 @@ godeps: deps .PHONY: gofmtmodtidy gofmtmodtidy: @echo gofmt -s -w ALL_GO_FILES - @gofmt -s -w $(shell find . -name '*.go') + @find . -name '*.go' -print0 | xargs -0 gofmt -s -w go mod tidy -v format:: gofmtmodtidy .PHONY: checknonolint checknonolint: - @if grep '//nolint' $(shell find . -name '*.go'); then \ + @if find . -name '*.go' -print0 | xargs -0 grep '//nolint'; then \ echo '//nolint directives found, surface ignores in .golangci.yml instead' >&2; \ exit 1; \ fi From 31fe6da6d9984eb2a5edee6785110363b0c972c1 Mon Sep 17 00:00:00 2001 From: John Chadwick Date: Wed, 21 Feb 2024 14:02:15 -0500 Subject: [PATCH 2/3] Fix checknonolint using grep --include --- make/go/go.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/make/go/go.mk b/make/go/go.mk index 48f849c..ebfcd25 100644 --- a/make/go/go.mk +++ b/make/go/go.mk @@ -91,7 +91,7 @@ format:: gofmtmodtidy .PHONY: checknonolint checknonolint: - @if find . -name '*.go' -print0 | xargs -0 grep '//nolint'; then \ + @if grep -r --include "*.go" '//nolint'; then \ echo '//nolint directives found, surface ignores in .golangci.yml instead' >&2; \ exit 1; \ fi From 8cc225ed70e5252a048dc2808671bbfd77359b8c Mon Sep 17 00:00:00 2001 From: jchadwick-buf <116005195+jchadwick-buf@users.noreply.github.com> Date: Wed, 21 Feb 2024 15:10:12 -0500 Subject: [PATCH 3/3] Use `gofmt .` instead of using `find` for formatting Co-authored-by: Philip K. Warren --- make/go/go.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/make/go/go.mk b/make/go/go.mk index ebfcd25..9741777 100644 --- a/make/go/go.mk +++ b/make/go/go.mk @@ -84,7 +84,7 @@ godeps: deps .PHONY: gofmtmodtidy gofmtmodtidy: @echo gofmt -s -w ALL_GO_FILES - @find . -name '*.go' -print0 | xargs -0 gofmt -s -w + @gofmt -s -w . go mod tidy -v format:: gofmtmodtidy