@@ -3,7 +3,7 @@ include .bingo/Variables.mk
3
3
SHELL =/usr/bin/env bash
4
4
5
5
PROVIDER_MODULES ?= $(shell find $(PWD ) /providers/ -name "go.mod" | grep -v ".bingo" | xargs dirname)
6
- MODULES ?= $(PROVIDER_MODULES ) $(PWD ) / $(PWD ) /examples
6
+ MODULES ?= $(PROVIDER_MODULES ) $(PWD ) $(PWD ) /examples
7
7
GO_FILES_TO_FMT ?= $(shell find . -path -prune -o -name '* .go' -print)
8
8
9
9
GOBIN ?= $(firstword $(subst :, ,${GOPATH}) ) /bin
@@ -48,14 +48,12 @@ fmt: $(GOIMPORTS)
48
48
.PHONY : test
49
49
test :
50
50
@echo " Running tests for all modules: $( MODULES) "
51
- for dir in $( MODULES) ; do \
52
- $(MAKE ) test_module DIR=$$ {dir} ; \
53
- done
51
+ $(MAKE ) $(MODULES:%=test_module_% )
54
52
55
- .PHONY : test_module
56
- test_module :
57
- @echo " Running tests for dir: $( DIR ) "
58
- cd $( DIR ) && go test -v -race ./...
53
+ .PHONY : test_module_ %
54
+ $(MODULES:% =test_module_%): test_module_% :
55
+ @echo "Running tests for dir: $* "
56
+ cd $* && go test -v -race ./...
59
57
60
58
.PHONY : deps
61
59
deps :
@@ -93,27 +91,25 @@ lint: $(BUF) $(COPYRIGHT) fmt docs
93
91
94
92
@echo "Running lint for all modules: $(MODULES)"
95
93
@$(call require_clean_work_tree,"before lint")
96
- for dir in $(MODULES) ; do \
97
- $(MAKE) lint_module DIR=$${dir} ; \
98
- done
94
+ $(MAKE) $(MODULES:%=lint_module_%)
99
95
@$(call require_clean_work_tree,"lint and format files")
100
96
101
- .PHONY : lint_module
97
+ .PHONY : lint_module_ %
102
98
# PROTIP:
103
99
# Add
104
100
# --cpu-profile-path string Path to CPU profile output file
105
101
# --mem-profile-path string Path to memory profile output file
106
102
# to debug big allocations during linting.
107
- lint_module : # # Runs various static analysis against our code.
108
- lint_module : $(FAILLINT ) $(GOLANGCI_LINT ) $(MISSPELL )
103
+ lint_module_ % : # # Runs various static analysis against our code.
104
+ $(MODULES:% =lint_module_%): lint_module_% : $(FAILLINT ) $(GOLANGCI_LINT ) $(MISSPELL )
109
105
@echo ">> verifying modules being imported"
110
- @cd $( DIR ) && $(FAILLINT ) -paths " fmt.{Print,Printf,Println},github.com/golang/protobuf=google.golang.org/protobuf" ./...
106
+ @cd $* && $(FAILLINT) -paths "fmt.{Print,Printf,Println},github.com/golang/protobuf=google.golang.org/protobuf" ./...
111
107
112
108
@echo ">> examining all of the Go files"
113
- @cd $( DIR ) && go vet -stdmethods=false ./...
109
+ @cd $* && go vet -stdmethods=false ./...
114
110
115
111
@echo ">> linting all of the Go files GOGC=${GOGC}"
116
- @cd $( DIR ) && $(GOLANGCI_LINT ) run
112
+ @cd $* && $(GOLANGCI_LINT) run
117
113
@$(call require_clean_work_tree,"golangci lint")
118
114
119
115
0 commit comments