Skip to content

Commit

Permalink
chore: support linting all modules locally (#1609)
Browse files Browse the repository at this point in the history
* chore: support running golangci-lint for all modules

* fix: typo in error message
  • Loading branch information
mdelapenya committed Sep 12, 2023
1 parent b1b4a07 commit fec0b4d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
6 changes: 6 additions & 0 deletions commons-test.mk
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
ROOT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))

.PHONY: dependencies-scan
dependencies-scan:
@echo ">> Scanning dependencies in $(CURDIR)..."
go list -json -m all | docker run --rm -i sonatypecommunity/nancy:latest sleuth --skip-update-check

.PHONY: lint
lint:
golangci-lint run --out-format=github-actions --path-prefix=. --verbose -c $(ROOT_DIR)/.golangci.yml --fix

.PHONY: test-%
test-%:
@echo "Running $* tests..."
Expand Down
4 changes: 4 additions & 0 deletions examples/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ include ../commons-test.mk
dependencies-scan-examples:
@find . -type f -name Makefile -execdir make dependencies-scan \;

.PHONY: lint-examples
lint-examples:
@find . -type f -name Makefile -execdir make lint \;

.PHONY: tidy-examples
tidy-examples:
@find . -type f -name Makefile -execdir make tools-tidy \;
4 changes: 4 additions & 0 deletions modules/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ include ../commons-test.mk
dependencies-scan-modules:
@find . -type f -name Makefile -execdir make dependencies-scan \;

.PHONY: lint-modules
lint-modules:
@find . -type f -name Makefile -execdir make lint \;

.PHONY: tidy-modules
tidy-modules:
@find . -type f -name Makefile -execdir make tools-tidy \;
2 changes: 1 addition & 1 deletion modules/compose/compose_local.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ func (dc *LocalDockerCompose) applyStrategyToRunningContainer() error {
containerListOptions := types.ContainerListOptions{Filters: f, All: true}
containers, err := cli.ContainerList(context.Background(), containerListOptions)
if err != nil {
return fmt.Errorf("error %w occured while filtering the service %s: %d by name and published port", err, k.service, k.publishedPort)
return fmt.Errorf("error %w occurred while filtering the service %s: %d by name and published port", err, k.service, k.publishedPort)
}

if len(containers) == 0 {
Expand Down

0 comments on commit fec0b4d

Please sign in to comment.