Skip to content

Commit a76be0a

Browse files
committed
Makefile: add fmt target
Add simple fmt target to run golangci-lint fmt to format the source tree. Signed-off-by: Paul Holzinger <[email protected]>
1 parent becddbe commit a76be0a

File tree

4 files changed

+15
-1
lines changed

4 files changed

+15
-1
lines changed

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ lint: .install.golangci-lint
4949
@$(MAKE) -C image lint
5050
@$(MAKE) -C storage lint
5151

52+
.PHONY: fmt
53+
fmt: .install.golangci-lint
54+
@$(MAKE) -C common fmt
55+
@$(MAKE) -C image fmt
56+
@$(MAKE) -C storage fmt
57+
5258
.PHONY: vendor-in-container
5359
vendor-in-container:
5460
podman run --privileged --rm --env HOME=/root -v `pwd`:/src -w /src golang make vendor

common/Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ docs:
7474
lint:
7575
golangci-lint run
7676

77+
.PHONY: fmt
78+
fmt:
79+
golangci-lint fmt
80+
7781
.PHONY: validate
7882
validate: lint
7983
./tools/validate_seccomp.sh ./pkg/seccomp

image/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ test:
7575

7676
.PHONY: fmt
7777
fmt:
78-
@gofmt -l -s -w $(SOURCE_DIRS)
78+
golangci-lint fmt
7979

8080
.PHONY: lint
8181
lint:

storage/Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ install: install.docs
6969
lint:
7070
golangci-lint run --build-tags="$(AUTOTAGS) $(TAGS)"
7171

72+
.PHONY: fmt
73+
fmt:
74+
golangci-lint fmt
75+
7276
help: ## this help
7377
@awk 'BEGIN {FS = ":.*?## "} /^[a-z A-Z_-]+:.*?## / {gsub(" ",",",$$1);gsub("\\\\n",sprintf("\n%22c"," "), $$2);printf "\033[36m%-21s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
7478

0 commit comments

Comments
 (0)