From dd7d7a996fc24f72149a0e5c0c0326a1cc75513b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20de=20la=20Pe=C3=B1a?= Date: Fri, 14 Jun 2024 23:27:12 +0200 Subject: [PATCH] docs: update contributing guide (#2586) * chore: update make targets * docd: update contributing guides with go.mod and lint work * docs: wording --- .github/workflows/ci-test-go.yml | 2 +- Makefile | 7 ++++--- commons-test.mk | 4 ++-- docs/contributing.md | 6 +++++- examples/Makefile | 2 +- modules/Makefile | 2 +- 6 files changed, 14 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci-test-go.yml b/.github/workflows/ci-test-go.yml index b15f2a8556..282309ed4e 100644 --- a/.github/workflows/ci-test-go.yml +++ b/.github/workflows/ci-test-go.yml @@ -91,7 +91,7 @@ jobs: - name: modTidy working-directory: ./${{ inputs.project-directory }} - run: make tools-tidy + run: make tidy - name: ensure compilation working-directory: ./${{ inputs.project-directory }} diff --git a/Makefile b/Makefile index 17aaad5bb4..33efe9e987 100644 --- a/Makefile +++ b/Makefile @@ -6,12 +6,13 @@ test-all: tools test-tools test-unit .PHONY: test-examples test-examples: @echo "Running example tests..." - make -C examples test + $(MAKE) -C examples test .PHONY: tidy-all tidy-all: - make -C examples tidy-examples - make -C modules tidy-modules + $(MAKE) tidy + $(MAKE) -C examples tidy-examples + $(MAKE) -C modules tidy-modules ## ------------------------------------- diff --git a/commons-test.mk b/commons-test.mk index e99d62a224..d795c682a3 100644 --- a/commons-test.mk +++ b/commons-test.mk @@ -47,6 +47,6 @@ tools: .PHONY: test-tools test-tools: $(GOBIN)/gotestsum -.PHONY: tools-tidy -tools-tidy: +.PHONY: tidy +tidy: go mod tidy diff --git a/docs/contributing.md b/docs/contributing.md index 4cb1cde09c..822c113487 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -8,5 +8,9 @@ * follow the style, naming and structure conventions of the rest of the project. * make commits atomic and easy to merge. * when updating documentation, please see [our guidance for documentation contributions](contributing_docs.md). - * apply format running `go fmt`, or the shell script `./scripts/checks.sh` + * when updating the `go.mod` file, please run `make tidy-all` to ensure all modules are updated. It will run `golangci-lint` with the configuration set in the root directory of the project. Please be aware that the lint stage could fail if this is not done. + * apply format running `make lint` + * For examples: `make -C examples lint` + * For modules: `make -C modules lint` * verify all tests are passing. Build and test the project with `make test-all` to do this. + * For a given module or example, go to the module or example directory and run `make test`. diff --git a/examples/Makefile b/examples/Makefile index 1df43cc412..d6a6ea09fd 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -10,4 +10,4 @@ lint-examples: .PHONY: tidy-examples tidy-examples: - @find . -type f -name Makefile -execdir make tools-tidy \; + @find . -type f -name Makefile -execdir make tidy \; diff --git a/modules/Makefile b/modules/Makefile index 9f1e1d165d..450e84a882 100644 --- a/modules/Makefile +++ b/modules/Makefile @@ -10,4 +10,4 @@ lint-modules: .PHONY: tidy-modules tidy-modules: - @find . -type f -name Makefile -execdir make tools-tidy \; + @find . -type f -name Makefile -execdir make tidy \;