This is an automated email from the ASF dual-hosted git repository.

wusheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking-swck.git

commit a0a79174c5b2fdd694b138ca0e9a0f00c87e77ad
Author: Gao Hongtao <hanahm...@gmail.com>
AuthorDate: Tue Nov 3 16:27:25 2020 +0800

    Add goimports
    
    Signed-off-by: Gao Hongtao <hanahm...@gmail.com>
---
 Makefile | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index f535565..9dd8c69 100644
--- a/Makefile
+++ b/Makefile
@@ -81,14 +81,17 @@ else
 CONTROLLER_GEN=$(shell which controller-gen)
 endif
 
+GOIMPORTS := $(GOBIN)/goimports
+$(GOIMPORTS):
+       GO111MODULE=off go get -u golang.org/x/tools/cmd/goimports
 # The goimports tool does not arrange imports in 3 blocks if there are already 
more than three blocks.
 # To avoid that, before running it, we collapse all imports in one block, then 
run the formatter.
-format: ## Format all Go code
+format: $(GOIMPORTS) ## Format all Go code
        @for f in `find . -name '*.go'`; do \
            awk '/^import \($$/,/^\)$$/{if($$0=="")next}{print}' $$f > 
/tmp/fmt; \
            mv /tmp/fmt $$f; \
        done
-       @goimports -w -local github.com/skywalking-swck .
+       $(GOIMPORTS) -w -local github.com/skywalking-swck .
 
 ## Check that the status is consistent with CI.
 check: clean generate manifests

Reply via email to