@@ -176,6 +176,13 @@ azure-cns: $(CNS_BUILD_DIR)/azure-cns$(EXE_EXT) cns-archive
176176azure-vnet-telemetry : $(CNI_BUILD_DIR ) /azure-vnet-telemetry$(EXE_EXT )
177177acncli : $(ACNCLI_BUILD_DIR ) /acncli$(EXE_EXT ) acncli-archive
178178
179+ # Tool paths
180+ CONTROLLER_GEN := $(TOOLS_BIN_DIR ) /controller-gen
181+ GOCOV := $(TOOLS_BIN_DIR ) /gocov
182+ GOCOV_XML := $(TOOLS_BIN_DIR ) /gocov-xml
183+ GO_JUNIT_REPORT := $(TOOLS_BIN_DIR ) /go-junit-report
184+ GOLANGCI_LINT := $(TOOLS_BIN_DIR ) /golangci-lint
185+
179186# Azure-NPM only supports Linux for now.
180187ifeq ($(GOOS ) ,linux)
181188azure-cnms : $(CNMS_BUILD_DIR ) /azure-cnms$(EXE_EXT ) cnms-archive
@@ -459,6 +466,11 @@ release:
459466
460467PRETTYGOTEST := $(shell command -v gotest 2> /dev/null)
461468
469+ LINT_PKG ?= .
470+
471+ lint : $(GOLANGCI_LINT ) # # Fast lint
472+ $(GOLANGCI_LINT ) run -v $(LINT_PKG ) /...
473+
462474# run all tests
463475.PHONY : test-all
464476test-all :
@@ -482,28 +494,29 @@ kind:
482494$(TOOLS_DIR ) /go.mod :
483495 cd $(TOOLS_DIR ) ; go mod init && go mod tidy
484496
485- CONTROLLER_GEN := $(TOOLS_BIN_DIR ) /controller-gen
486497$(CONTROLLER_GEN ) : $(TOOLS_DIR ) /go.mod
487498 cd $(TOOLS_DIR ) ; go mod download; go build -tags=tools -o bin/controller-gen sigs.k8s.io/controller-tools/cmd/controller-gen
488499
489500controller-gen : $(CONTROLLER_GEN ) # # Build controller-gen
490501
491- GOCOV := $(TOOLS_BIN_DIR ) /gocov
492502$(GOCOV ) : $(TOOLS_DIR ) /go.mod
493503 cd $(TOOLS_DIR ) ; go mod download; go build -tags=tools -o bin/gocov github.com/axw/gocov/gocov
494504
495505gocov : $(GOCOV ) # # Build gocov
496506
497- GOCOV_XML := $(TOOLS_BIN_DIR ) /gocov-xml
498507$(GOCOV_XML ) : $(TOOLS_DIR ) /go.mod
499508 cd $(TOOLS_DIR ) ; go mod download; go build -tags=tools -o bin/gocov-xml github.com/AlekSi/gocov-xml
500509
501510gocov-xml : $(GOCOV_XML ) # # Build gocov-xml
502511
503- GO_JUNIT_REPORT := $(TOOLS_BIN_DIR ) /go-junit-report
504512$(GO_JUNIT_REPORT ) : $(TOOLS_DIR ) /go.mod
505513 cd $(TOOLS_DIR ) ; go mod download; go build -tags=tools -o bin/go-junit-report github.com/jstemmer/go-junit-report
506514
507515go-junit-report : $(GO_JUNIT_REPORT ) # # Build go-junit-report
508516
509- tools : gocov gocov-xml go-junit-report # # Build bins for build tools
517+ $(GOLANGCI_LINT ) : $(TOOLS_DIR ) /go.mod
518+ cd $(TOOLS_DIR ) ; go mod download; go build -tags=tools -o bin/golangci-lint github.com/golangci/golangci-lint/cmd/golangci-lint
519+
520+ golangci-lint : $(GOLANGCI_LINT ) # # Build golangci-lint
521+
522+ tools : gocov gocov-xml go-junit-report golangci-lint # # Build bins for build tools
0 commit comments