Skip to content

Commit

Permalink
Fix "make test" and "make lint"
Browse files Browse the repository at this point in the history
  • Loading branch information
olivierlemasle committed Aug 28, 2023
1 parent 99b851f commit 97b13d0
Showing 1 changed file with 12 additions and 16 deletions.
28 changes: 12 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,12 @@ fmt: $(GOIMPORTS)
.PHONY: test
test:
@echo "Running tests for all modules: $(MODULES)"
for dir in $(MODULES) ; do \
$(MAKE) test_module DIR=$${dir} ; \
done
$(MAKE) $(MODULES:%=test_module_%)

.PHONY: test_module
test_module:
@echo "Running tests for dir: $(DIR)"
cd $(DIR) && go test -v -race ./...
.PHONY: test_module_%
$(MODULES:%=test_module_%): test_module_%:
@echo "Running tests for dir: $*"
cd $* && go test -v -race ./...

.PHONY: deps
deps:
Expand Down Expand Up @@ -93,27 +91,25 @@ lint: $(BUF) $(COPYRIGHT) fmt docs

@echo "Running lint for all modules: $(MODULES)"
@$(call require_clean_work_tree,"before lint")
for dir in $(MODULES) ; do \
$(MAKE) lint_module DIR=$${dir} ; \
done
$(MAKE) $(MODULES:%=lint_module_%)
@$(call require_clean_work_tree,"lint and format files")

.PHONY: lint_module
.PHONY: lint_module_%
# PROTIP:
# Add
# --cpu-profile-path string Path to CPU profile output file
# --mem-profile-path string Path to memory profile output file
# to debug big allocations during linting.
lint_module: ## Runs various static analysis against our code.
lint_module: $(FAILLINT) $(GOLANGCI_LINT) $(MISSPELL)
lint_module_%: ## Runs various static analysis against our code.
$(MODULES:%=lint_module_%): lint_module_%: $(FAILLINT) $(GOLANGCI_LINT) $(MISSPELL)
@echo ">> verifying modules being imported"
@cd $(DIR) && $(FAILLINT) -paths "fmt.{Print,Printf,Println},github.com/golang/protobuf=google.golang.org/protobuf" ./...
@cd $* && $(FAILLINT) -paths "fmt.{Print,Printf,Println},github.com/golang/protobuf=google.golang.org/protobuf" ./...

@echo ">> examining all of the Go files"
@cd $(DIR) && go vet -stdmethods=false ./...
@cd $* && go vet -stdmethods=false ./...

@echo ">> linting all of the Go files GOGC=${GOGC}"
@cd $(DIR) && $(GOLANGCI_LINT) run
@cd $* && $(GOLANGCI_LINT) run
@$(call require_clean_work_tree,"golangci lint")


Expand Down

0 comments on commit 97b13d0

Please sign in to comment.