@@ -127,11 +127,27 @@ install:
127127# ==============================================================================
128128
129129.PHONY : test
130- # # test: Run all tests with race detector
130+ # # test: Run all tests with race detector in all modules
131131test :
132- @echo " $( COLOR_GREEN) Running tests...$( COLOR_RESET) "
133- @$(GOTEST ) $(TEST_FLAGS ) $(TEST_DIRS )
134- @echo " $( COLOR_GREEN) ✓ All tests passed$( COLOR_RESET) "
132+ @echo " $( COLOR_GREEN) Running tests in all modules...$( COLOR_RESET) "
133+ @COUNT=0; FAILED=0; \
134+ ROOT_DIR=$$(pwd ) ; \
135+ for modfile in $$ (find . -name " go.mod" -type f | grep -v " /vendor/" | sort); do \
136+ dir=$$(dirname $$modfile ) ; \
137+ echo " Testing $$ dir..." ; \
138+ if cd " $$ ROOT_DIR/$$ dir" && $( GOTEST) $( TEST_FLAGS) ./...; then \
139+ COUNT=$$((COUNT + 1 ) ); \
140+ else \
141+ FAILED=$$((FAILED + 1 ) ); \
142+ fi ; \
143+ done ; \
144+ cd " $$ ROOT_DIR" ; \
145+ if [ $$ FAILED -eq 0 ]; then \
146+ echo " $( COLOR_GREEN) ✓ All tests passed in $$ COUNT modules$( COLOR_RESET) " ; \
147+ else \
148+ echo " $( COLOR_RED) ✗ Tests failed in $$ FAILED module(s), passed in $$ COUNT module(s)$( COLOR_RESET) " ; \
149+ exit 1; \
150+ fi
135151
136152.PHONY : test-short
137153# # test-short: Run tests with -short flag
@@ -217,16 +233,31 @@ bench-compare:
217233# ==============================================================================
218234
219235.PHONY : lint
220- # # lint: Run golangci-lint
236+ # # lint: Run golangci-lint on all modules
221237lint :
222- @echo " $( COLOR_GREEN) Running linter...$( COLOR_RESET) "
223- @if command -v $(GOLANGCI_LINT ) > /dev/null 2>&1 ; then \
224- $(GOLANGCI_LINT ) run $(LINT_DIRS ) --timeout=5m; \
225- echo " $( COLOR_GREEN) ✓ Linting passed$( COLOR_RESET) " ; \
226- else \
238+ @echo " $( COLOR_GREEN) Running linter on all modules...$( COLOR_RESET) "
239+ @if ! command -v $(GOLANGCI_LINT ) > /dev/null 2>&1 ; then \
227240 echo " $( COLOR_RED) Error: golangci-lint not found. Run 'make install-tools' to install$( COLOR_RESET) " ; \
228241 exit 1; \
229242 fi
243+ @COUNT=0; FAILED=0; \
244+ ROOT_DIR=$$(pwd ) ; \
245+ for modfile in $$ (find . -name " go.mod" -type f | grep -v " /vendor/" | sort); do \
246+ dir=$$(dirname $$modfile ) ; \
247+ echo " Linting $$ dir..." ; \
248+ if cd " $$ ROOT_DIR/$$ dir" && $( GOLANGCI_LINT) run ./... --timeout=5m; then \
249+ COUNT=$$((COUNT + 1 ) ); \
250+ else \
251+ FAILED=$$((FAILED + 1 ) ); \
252+ fi ; \
253+ done ; \
254+ cd " $$ ROOT_DIR" ; \
255+ if [ $$ FAILED -eq 0 ]; then \
256+ echo " $( COLOR_GREEN) ✓ Linting passed for $$ COUNT modules$( COLOR_RESET) " ; \
257+ else \
258+ echo " $( COLOR_RED) ✗ Linting failed in $$ FAILED module(s), passed in $$ COUNT module(s)$( COLOR_RESET) " ; \
259+ exit 1; \
260+ fi
230261
231262.PHONY : lint-fix
232263# # lint-fix: Run golangci-lint with auto-fix
@@ -235,11 +266,19 @@ lint-fix:
235266 @$(GOLANGCI_LINT ) run $(LINT_DIRS ) --fix --timeout=5m
236267
237268.PHONY : fmt
238- # # fmt: Format Go code
269+ # # fmt: Format Go code in all modules
239270fmt :
240- @echo " $( COLOR_GREEN) Formatting code...$( COLOR_RESET) "
241- @$(GOFMT ) $(TEST_DIRS )
242- @echo " $( COLOR_GREEN) ✓ Code formatted$( COLOR_RESET) "
271+ @echo " $( COLOR_GREEN) Formatting code in all modules...$( COLOR_RESET) "
272+ @COUNT=0; \
273+ ROOT_DIR=$$(pwd ) ; \
274+ for modfile in $$ (find . -name " go.mod" -type f | grep -v " /vendor/" | sort); do \
275+ dir=$$(dirname $$modfile ) ; \
276+ echo " Formatting $$ dir..." ; \
277+ cd " $$ ROOT_DIR/$$ dir" && $(GOFMT ) ./...; \
278+ COUNT=$$((COUNT + 1 ) ); \
279+ done ; \
280+ cd " $$ ROOT_DIR" ; \
281+ echo " $( COLOR_GREEN) ✓ Formatted $$ COUNT modules$( COLOR_RESET) "
243282
244283.PHONY : fmt-check
245284# # fmt-check: Check if code is formatted
@@ -249,18 +288,34 @@ fmt-check:
249288 (echo " $( COLOR_RED) Code is not formatted. Run 'make fmt'$( COLOR_RESET) " && exit 1)
250289
251290.PHONY : vet
252- # # vet: Run go vet
291+ # # vet: Run go vet on all modules
253292vet :
254- @echo " $( COLOR_GREEN) Running go vet...$( COLOR_RESET) "
255- @$(GOVET ) $(TEST_DIRS )
256- @echo " $( COLOR_GREEN) ✓ Vet passed$( COLOR_RESET) "
293+ @echo " $( COLOR_GREEN) Running go vet on all modules...$( COLOR_RESET) "
294+ @COUNT=0; \
295+ ROOT_DIR=$$(pwd ) ; \
296+ for modfile in $$ (find . -name " go.mod" -type f | grep -v " /vendor/" | sort); do \
297+ dir=$$(dirname $$modfile ) ; \
298+ echo " Vetting $$ dir..." ; \
299+ cd " $$ ROOT_DIR/$$ dir" && $(GOVET ) ./...; \
300+ COUNT=$$((COUNT + 1 ) ); \
301+ done ; \
302+ cd " $$ ROOT_DIR" ; \
303+ echo " $( COLOR_GREEN) ✓ Vet passed for $$ COUNT modules$( COLOR_RESET) "
257304
258305.PHONY : tidy
259- # # tidy: Tidy go modules
306+ # # tidy: Tidy all go modules
260307tidy :
261- @echo " $( COLOR_GREEN) Tidying modules...$( COLOR_RESET) "
262- @$(GOMOD ) tidy
263- @echo " $( COLOR_GREEN) ✓ Modules tidied$( COLOR_RESET) "
308+ @echo " $( COLOR_GREEN) Tidying all modules...$( COLOR_RESET) "
309+ @COUNT=0; \
310+ ROOT_DIR=$$(pwd ) ; \
311+ for modfile in $$ (find . -name " go.mod" -type f | grep -v " /vendor/" | sort); do \
312+ dir=$$(dirname $$modfile ) ; \
313+ echo " Tidying $$ dir..." ; \
314+ cd " $$ ROOT_DIR/$$ dir" && $(GOMOD ) tidy; \
315+ COUNT=$$((COUNT + 1 ) ); \
316+ done ; \
317+ cd " $$ ROOT_DIR" ; \
318+ echo " $( COLOR_GREEN) ✓ Tidied $$ COUNT modules$( COLOR_RESET) "
264319
265320.PHONY : tidy-check
266321# # tidy-check: Check if go.mod is tidy
0 commit comments