Skip to content

Commit 17633f7

Browse files
committed
build: add templ fmt to format and lint targets
Run templ fmt as part of make format and make lint to ensure .templ files are consistently formatted. Also fix existing formatting issues flagged by the formatter. Signed-off-by: Robin Jarry <rjarry@redhat.com>
1 parent e60f1e7 commit 17633f7

3 files changed

Lines changed: 194 additions & 188 deletions

File tree

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,11 @@ test:
8888
.PHONY: lint
8989
lint:
9090
$(GO) generate ./...
91+
@echo '[templ fmt]'
92+
$Q $(GO) tool templ fmt -fail . 2>&1 || { \
93+
echo 'error: templ files need reformatting'; \
94+
exit 1; \
95+
}
9196
@echo '[goimports-reviser]'
9297
$Q ! $(GO) run $(import_reviser) $(import_reviser_flags) -list-diff -output stdout ./... | grep . || { \
9398
echo 'error: above files need import sorting'; \
@@ -116,6 +121,7 @@ lint:
116121

117122
.PHONY: format
118123
format:
124+
$(GO) tool templ fmt .
119125
$(GO) run $(import_reviser) $(import_reviser_flags) ./...
120126
$(GO) run $(gofumpt) -w .
121127

pkg/web/layout.templ

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ type pageContext struct {
1717
CSRFToken string
1818
Version string
1919
CustomCSS bool
20-
NavHTML string
20+
NavHTML string
2121
ProjectNavHTML string
2222
FooterHTML string
2323
}

0 commit comments

Comments
 (0)