@@ -181,8 +181,9 @@ acncli: $(ACNCLI_BUILD_DIR)/acncli$(EXE_EXT) acncli-archive
181181CONTROLLER_GEN := $(TOOLS_BIN_DIR ) /controller-gen
182182GOCOV := $(TOOLS_BIN_DIR ) /gocov
183183GOCOV_XML := $(TOOLS_BIN_DIR ) /gocov-xml
184- GO_JUNIT_REPORT := $(TOOLS_BIN_DIR ) /go-junit-report
184+ GOFUMPT := $(TOOLS_BIN_DIR ) /gofumpt
185185GOLANGCI_LINT := $(TOOLS_BIN_DIR ) /golangci-lint
186+ GO_JUNIT_REPORT := $(TOOLS_BIN_DIR ) /go-junit-report
186187MOCKGEN := $(TOOLS_BIN_DIR ) /mockgen
187188
188189# Azure-NPM only supports Linux for now.
@@ -473,11 +474,16 @@ PRETTYGOTEST := $(shell command -v gotest 2> /dev/null)
473474LINT_PKG ?= .
474475
475476lint : $(GOLANGCI_LINT ) # # Fast lint vs default branch showing only new issues
476- $(GOLANGCI_LINT ) run --new-from-rev= master -v $(LINT_PKG ) /...
477+ $(GOLANGCI_LINT ) run --new-from-rev master --timeout 10m -v $(LINT_PKG ) /...
477478
478479lint-old : $(GOLANGCI_LINT ) # # Fast lint including previous issues
479480 $(GOLANGCI_LINT ) run -v $(LINT_PKG ) /...
480481
482+ FMT_PKG ?= cni cns npm
483+
484+ fmt format : $(GOFUMPT ) # # run gofumpt on $FMT_PKG (default "cni cns npm")
485+ $(GOFUMPT ) -s -w $(FMT_PKG )
486+
481487# run all tests
482488.PHONY : test-all
483489test-all :
@@ -519,16 +525,21 @@ $(GOCOV_XML): $(TOOLS_DIR)/go.mod
519525
520526gocov-xml : $(GOCOV_XML ) # # Build gocov-xml
521527
522- $(GO_JUNIT_REPORT ) : $(TOOLS_DIR ) /go.mod
523- cd $(TOOLS_DIR ) ; go mod download; go build -tags=tools -o bin/go-junit-report github.com/jstemmer/go-junit-report
528+ $(GOFUMPT ) : $(TOOLS_DIR ) /go.mod
529+ cd $(TOOLS_DIR ) ; go mod download; go build -tags=tools -o bin/gofumpt mvdan.cc/gofumpt
524530
525- go-junit-report : $(GO_JUNIT_REPORT ) # # Build go-junit-report
531+ gofmt gofumpt : $(GOFUMPT ) # # Build gofumpt
526532
527533$(GOLANGCI_LINT ) : $(TOOLS_DIR ) /go.mod
528534 cd $(TOOLS_DIR ) ; go mod download; go build -tags=tools -o bin/golangci-lint github.com/golangci/golangci-lint/cmd/golangci-lint
529535
530536golangci-lint : $(GOLANGCI_LINT ) # # Build golangci-lint
531537
538+ $(GO_JUNIT_REPORT ) : $(TOOLS_DIR ) /go.mod
539+ cd $(TOOLS_DIR ) ; go mod download; go build -tags=tools -o bin/go-junit-report github.com/jstemmer/go-junit-report
540+
541+ go-junit-report : $(GO_JUNIT_REPORT ) # # Build go-junit-report
542+
532543$(MOCKGEN ) : $(TOOLS_DIR ) /go.mod
533544 cd $(TOOLS_DIR ) ; go mod download; go build -tags=tools -o bin/mockgen github.com/golang/mock/mockgen
534545
0 commit comments