From 14579fa55a80eeb145066193e574ebe4954b2420 Mon Sep 17 00:00:00 2001 From: Sas Swart Date: Mon, 30 Dec 2024 12:56:22 +0200 Subject: [PATCH] chore(Makefile): add shell safety to fmt/go (#15974) This PR adds shell safety to `make fmt/go` as per https://github.com/coder/coder/pull/15971#discussion_r1899423172 --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 2cd3c0e0fb..9347eb15a2 100644 --- a/Makefile +++ b/Makefile @@ -417,14 +417,14 @@ RESET := $(shell tput sgr0 2>/dev/null) fmt: fmt/ts fmt/go fmt/terraform fmt/shfmt fmt/prettier .PHONY: fmt -GO_FMT_FILES := $(shell find . $(FIND_EXCLUSIONS) -type f -name '*.go' -exec sh -c 'grep -L "DO NOT EDIT" "{}" 2>/dev/null || true' \;) - fmt/go: go mod tidy echo "$(GREEN)==>$(RESET) $(BOLD)fmt/go$(RESET)" # VS Code users should check out # https://github.com/mvdan/gofumpt#visual-studio-code - go run mvdan.cc/gofumpt@v0.4.0 -w -l $(GO_FMT_FILES) + find . $(FIND_EXCLUSIONS) -type f -name '*.go' -print0 | \ + xargs -0 grep --null -L "DO NOT EDIT" | \ + xargs -0 go run mvdan.cc/gofumpt@v0.4.0 -w -l .PHONY: fmt/go fmt/ts: