mirror of
https://github.com/lightningnetwork/lnd.git
synced 2024-11-19 01:43:16 +01:00
github+Makefile: add new action make tidy-module-check
This commit adds `tidy-module` and `tidy-module-check` to make sure the modules are always tidy.
This commit is contained in:
parent
8813bc7ba8
commit
c568ba9fa2
3
.github/workflows/main.yml
vendored
3
.github/workflows/main.yml
vendored
@ -131,6 +131,9 @@ jobs:
|
|||||||
- name: check code format
|
- name: check code format
|
||||||
run: make fmt-check
|
run: make fmt-check
|
||||||
|
|
||||||
|
- name: check go modules tidiness
|
||||||
|
run: make tidy-module-check
|
||||||
|
|
||||||
- name: lint
|
- name: lint
|
||||||
run: GOGC=50 make lint
|
run: GOGC=50 make lint
|
||||||
|
|
||||||
|
7
Makefile
7
Makefile
@ -246,6 +246,13 @@ lint: docker-tools
|
|||||||
@$(call print, "Linting source.")
|
@$(call print, "Linting source.")
|
||||||
$(DOCKER_TOOLS) golangci-lint run -v $(LINT_WORKERS)
|
$(DOCKER_TOOLS) golangci-lint run -v $(LINT_WORKERS)
|
||||||
|
|
||||||
|
tidy-module:
|
||||||
|
echo "Running 'go mod tidy' for all modules"
|
||||||
|
scripts/tidy_modules.sh
|
||||||
|
|
||||||
|
tidy-module-check: tidy-module
|
||||||
|
if test -n "$$(git status --porcelain)"; then echo "modules not updated, please run `make tidy-module` again!"; git status; exit 1; fi
|
||||||
|
|
||||||
list:
|
list:
|
||||||
@$(call print, "Listing commands.")
|
@$(call print, "Listing commands.")
|
||||||
@$(MAKE) -qp | \
|
@$(MAKE) -qp | \
|
||||||
|
17
scripts/tidy_modules.sh
Executable file
17
scripts/tidy_modules.sh
Executable file
@ -0,0 +1,17 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
SUBMODULES=$(find . -mindepth 2 -name "go.mod" | cut -d'/' -f2)
|
||||||
|
|
||||||
|
|
||||||
|
# Run 'go mod tidy' for root.
|
||||||
|
go mod tidy
|
||||||
|
|
||||||
|
# Run 'go mod tidy' for each module.
|
||||||
|
for submodule in $SUBMODULES
|
||||||
|
do
|
||||||
|
pushd $submodule
|
||||||
|
|
||||||
|
go mod tidy
|
||||||
|
|
||||||
|
popd
|
||||||
|
done
|
Loading…
Reference in New Issue
Block a user