|
27 | 27 | gofmt -s -w ./$(PKG_NAME) |
28 | 28 |
|
29 | 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) |
| 30 | + @if [[ -z $(CHANGED_FILES) ]]; then \ |
| 31 | + echo "skip the fmt cause the CHANGED_FILES is null."; \ |
| 32 | + exit 0; \ |
| 33 | + else \ |
| 34 | + echo "==> [Faster]Fixing source code with gofmt...\n $(CHANGED_FILES) \n"; \ |
| 35 | + goimports -w $(CHANGED_FILES); \ |
| 36 | + gofmt -s -w $(CHANGED_FILES); \ |
| 37 | + fi |
33 | 38 |
|
34 | 39 | # Currently required by tf-deploy compile |
35 | 40 | fmtcheck: |
@@ -101,10 +106,9 @@ lint: |
101 | 106 | ./$(PKG_NAME) |
102 | 107 |
|
103 | 108 | tools: |
104 | | - GO111MODULE=on go install github.com/bflad/tfproviderlint/cmd/tfproviderlint |
105 | | - GO111MODULE=on go install github.com/client9/misspell/cmd/misspell |
106 | | - GO111MODULE=on go install github.com/golangci/golangci-lint/cmd/golangci-lint |
107 | | - GO111MODULE=on go install github.com/katbyte/terrafmt |
| 109 | + GO111MODULE=on cd .ci/tools && go install github.com/bflad/tfproviderlint/cmd/tfproviderlint && cd ../.. |
| 110 | + GO111MODULE=on cd .ci/tools && go install github.com/client9/misspell/cmd/misspell && cd ../.. |
| 111 | + GO111MODULE=on cd .ci/tools && go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.45.2 && cd ../.. |
108 | 112 |
|
109 | 113 | test-compile: |
110 | 114 | @if [ "$(TEST)" = "./..." ]; then \ |
@@ -136,9 +140,24 @@ test-build-x86: |
136 | 140 | doc: |
137 | 141 | cd gendoc && go run ./... && cd .. |
138 | 142 |
|
| 143 | +doc-faster: |
| 144 | + @echo "==> [Faster]Generating doc..." |
| 145 | + @if [ ! -f gendoc/gendoc ]; then \ |
| 146 | + $(MAKE) doc-bin-build; \ |
| 147 | + fi |
| 148 | + @$(MAKE) doc-with-bin |
| 149 | + |
| 150 | +doc-with-bin: |
| 151 | + cd gendoc && ./gendoc ./... && cd .. |
| 152 | + |
| 153 | +doc-bin-build: |
| 154 | + @echo "==> Building gendoc binary..." |
| 155 | + cd gendoc && go build ./... && cd .. |
| 156 | + |
139 | 157 | hooks: tools |
140 | | - find .git/hooks -type l -exec rm {} \; |
141 | | - find .githooks -type f -exec ln -sf ../../{} .git/hooks/ \; |
| 158 | + @find .git/hooks -type l -exec rm {} \; |
| 159 | + @find .githooks -type f -exec ln -sf ../../{} .git/hooks/ \; |
| 160 | + @echo "==> Install hooks done." |
142 | 161 |
|
143 | 162 | website: |
144 | 163 | ifeq (,$(wildcard $(GOPATH)/src/$(WEBSITE_REPO))) |
|
0 commit comments