From b1e0d5b39f6eecc0a17dee9b26af2ae54cd6af8c Mon Sep 17 00:00:00 2001
From: Oleg Lobanov <oleg@lobanov.me>
Date: Mon, 20 Dec 2021 22:36:35 +0100
Subject: [PATCH] chore: add make fmt target

---
 Makefile               | 8 ++++++--
 frontend/assets.go     | 1 +
 frontend/assets_dev.go | 1 +
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 92b28c68..1a61a10a 100644
--- a/Makefile
+++ b/Makefile
@@ -35,7 +35,7 @@ GOLANGCI_LINT = $(BIN)/golangci-lint
 $(BIN)/golangci-lint: PACKAGE=github.com/golangci/golangci-lint/cmd/golangci-lint@v1.41.1
 
 GOIMPORTS = $(BIN)/goimports
-$(BIN)/goimports: PACKAGE=golang.org/x/tools/cmd/goimports@v0.1.5
+$(BIN)/goimports: PACKAGE=golang.org/x/tools/cmd/goimports@v0.1.8
 
 ## build: Build
 .PHONY: build
@@ -76,13 +76,17 @@ lint-frontend: | ; $(info $(M) running frontend linters…)
 ## lint-backend: Lint backend
 .PHONY: lint-backend
 lint-backend: | $(GOLANGCI_LINT) ; $(info $(M) running backend linters…)
-	$Q $(GOLANGCI_LINT) run
+	$Q $(GOLANGCI_LINT) run -v
 
 ## lint-commits: Lint commits
 .PHONY: lint-commits
 lint-commits: | ; $(info $(M) running commitlint…)
 	$Q ./scripts/commitlint.sh
 
+## fmt: Format source files
+fmt: $(GOIMPORTS)
+	$Q $(GOIMPORTS) -local $(MODULE) -w $$(find . -type f -name '*.go' -not -path "./vendor/*")
+
 ## bump-version: Bump app version
 .PHONY: bump-version
 bump-version: | ; $(info $(M) creating a new release…)
diff --git a/frontend/assets.go b/frontend/assets.go
index 3509eff6..01c523f0 100644
--- a/frontend/assets.go
+++ b/frontend/assets.go
@@ -1,3 +1,4 @@
+//go:build !dev
 // +build !dev
 
 package frontend
diff --git a/frontend/assets_dev.go b/frontend/assets_dev.go
index 5c2ccf06..292cd1d0 100644
--- a/frontend/assets_dev.go
+++ b/frontend/assets_dev.go
@@ -1,3 +1,4 @@
+//go:build dev
 // +build dev
 
 package frontend