From 4898f31f6df000ff5d11cc0835110ca974fc706b Mon Sep 17 00:00:00 2001
From: Deluan <deluan@deluan.com>
Date: Mon, 19 Jun 2023 11:15:51 -0400
Subject: [PATCH] Add `format` target to Makefile

---
 .github/workflows/pipeline.yml | 2 +-
 Makefile                       | 6 ++++++
 tests/fixtures/synlink_invalid | 1 -
 3 files changed, 7 insertions(+), 2 deletions(-)
 delete mode 120000 tests/fixtures/synlink_invalid

diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml
index a7ec34c30..f4c386ed4 100644
--- a/.github/workflows/pipeline.yml
+++ b/.github/workflows/pipeline.yml
@@ -39,7 +39,7 @@ jobs:
         run: |
           git status --porcelain
           if [ -n "$(git status --porcelain)" ]; then
-            echo 'To fix this check, run "goimports -w $(find . -name '*.go' | grep -v '_gen.go$') && go mod tidy"'
+            echo 'To fix this check, run "make format" and commit the changes'
             exit 1
           fi
 
diff --git a/Makefile b/Makefile
index 43dca10a9..afe3cd820 100644
--- a/Makefile
+++ b/Makefile
@@ -45,6 +45,12 @@ lintall: lint ##@Development Lint Go and JS code
 	@(cd ./ui && npm run lint)
 .PHONY: lintall
 
+format: ##@Development Format code
+	@(cd ./ui && npm run prettier)
+	@go run golang.org/x/tools/cmd/goimports -w `find . -name '*.go' | grep -v '_gen.go$''`
+	@go mod tidy
+.PHONY: format
+
 wire: check_go_env ##@Development Update Dependency Injection
 	go run github.com/google/wire/cmd/wire@latest ./...
 .PHONY: wire
diff --git a/tests/fixtures/synlink_invalid b/tests/fixtures/synlink_invalid
deleted file mode 120000
index d30fa5577..000000000
--- a/tests/fixtures/synlink_invalid
+++ /dev/null
@@ -1 +0,0 @@
-INVALID
\ No newline at end of file