Skip to content

Commit cdeb7d3

Browse files
author
Sahid Velji
committed
chore: add multi-module compatible Makefile targets
Signed-off-by: Sahid Velji <[email protected]>
1 parent b435fb4 commit cdeb7d3

File tree

1 file changed

+27
-7
lines changed

1 file changed

+27
-7
lines changed

Makefile

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,10 @@ workspace-init:
1010
workspace-update:
1111
$(foreach module, $(ALL_GO_MOD_DIRS), go work use $(module);)
1212

13-
test:
14-
go list -f '{{.Dir}}/...' -m | xargs -I{} go test -v {}
15-
1613
# call with TESTCONTAINERS_RYUK_DISABLED="true" to avoid problems with podman on Macs
1714
e2e:
1815
go clean -testcache && go list -f '{{.Dir}}/...' -m | xargs -I{} go test -tags=e2e {}
1916

20-
lint:
21-
go install -v github.com/golangci/golangci-lint/cmd/[email protected]
22-
$(foreach module, $(ALL_GO_MOD_DIRS), ${GOPATH}/bin/golangci-lint run $(module)/...;)
23-
2417
new-provider:
2518
mkdir ./providers/$(MODULE_NAME)
2619
cd ./providers/$(MODULE_NAME) && go mod init github.com/open-feature/go-sdk-contrib/providers/$(MODULE_NAME) && touch README.md
@@ -34,3 +27,30 @@ new-hook:
3427
append-to-release-please:
3528
jq '.packages += {"${MODULE_TYPE}/${MODULE_NAME}": {"release-type":"go","package-name":"${MODULE_TYPE}/${MODULE_NAME}","bump-minor-pre-major":true,"bump-patch-for-minor-pre-major":true,"versioning":"default","extra-files": []}}' release-please-config.json > tmp.json
3629
mv tmp.json release-please-config.json
30+
31+
.PHONY: go-mod-tidy
32+
go-mod-tidy: $(ALL_GO_MOD_DIRS:%=go-mod-tidy/%)
33+
go-mod-tidy/%: DIR=$*
34+
go-mod-tidy/%:
35+
@echo "go mod tidy in $(DIR)" \
36+
&& cd $(DIR) \
37+
&& go mod tidy
38+
39+
.PHONY: golangci-lint golangci-lint-fix
40+
golangci-lint-fix: ARGS=--fix
41+
golangci-lint-fix: golangci-lint
42+
golangci-lint: $(ALL_GO_MOD_DIRS:%=golangci-lint/%)
43+
golangci-lint/%: DIR=$*
44+
golangci-lint/%:
45+
@echo 'golangci-lint $(if $(ARGS),$(ARGS) ,)$(DIR)' \
46+
&& cd $(DIR) \
47+
&& go run github.com/golangci/golangci-lint/cmd/[email protected] run --allow-serial-runners $(ARGS)
48+
49+
.PHONY: test
50+
test-verbose: ARGS=-v
51+
test: $(ALL_GO_MOD_DIRS:%=test/%)
52+
test/%: DIR=$*
53+
test/%:
54+
@echo "go test $(ARGS) $(DIR)/..." \
55+
&& cd $(DIR) \
56+
&& go test $(ARGS) ./...

0 commit comments

Comments
 (0)