Skip to content

Commit 543ca97

Browse files
authored
Support make fmt-faster to only fmt with the changed files (#1940)
* example readjust: tencentcloud_kubernetes_serverless_node_pool * faster the make fmt
1 parent e6dde91 commit 543ca97

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

GNUmakefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
TEST?=./...
22
GOFMT_FILES?=$$(find . -name '*.go' |grep -v vendor)
33
PKG_NAME=tencentcloud
4+
CHANGED_FILES=$$(git diff --name-only master -- $(PKG_NAME))
45
WEBSITE_REPO=github.com/hashicorp/terraform-website
56
PLATFORMS=darwin/amd64 freebsd/386 freebsd/amd64 freebsd/arm linux/386 linux/amd64 linux/arm openbsd/amd64 openbsd/386 solaris/amd64 windows/386 windows/amd64
67
GO_VER ?= go
@@ -25,6 +26,11 @@ fmt:
2526
goimports -w ./$(PKG_NAME)
2627
gofmt -s -w ./$(PKG_NAME)
2728

29+
fmt-faster:
30+
@echo "==> [Faster]Fixing source code with gofmt...\n $(CHANGED_FILES) \n"
31+
goimports -w $(CHANGED_FILES)
32+
gofmt -s -w $(CHANGED_FILES)
33+
2834
# Currently required by tf-deploy compile
2935
fmtcheck:
3036
@sh -c "'$(CURDIR)/scripts/gofmtcheck.sh'"

0 commit comments

Comments
 (0)