From 7d168b9a5b214b4989a56a49b4c182c15c37ddfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Ovejero?= Date: Thu, 28 Nov 2024 14:52:30 +0100 Subject: [PATCH] ci: Introduce format check (#40) --- .github/workflows/checks.yml | 2 +- Makefile | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 15562ca..964a59d 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -16,7 +16,7 @@ jobs: version: latest - name: Format check - run: go fmt ./... + run: make fmt-check - name: Static analysis run: go vet ./... diff --git a/Makefile b/Makefile index 433f318..75fccc3 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: audit build lint lintfix run +.PHONY: audit build lint lintfix fmt fmt-check run test test-verbose test-coverage check: lint go fmt ./... @@ -13,6 +13,15 @@ lint: lintfix: golangci-lint run --fix +fmt: + go fmt ./... + +fmt-check: + @if [ -n "$$(go fmt ./...)" ]; then \ + echo "Found unformatted Go files. Please run 'make fmt'"; \ + exit 1; \ + fi + run: build ./bin/main javascript