From e9c509b0b8718b001ee52883c137b4fe2199cb7d Mon Sep 17 00:00:00 2001 From: Kartikay Date: Sun, 18 Feb 2024 20:32:55 +0530 Subject: [PATCH] added makefile target for linting the code Signed-off-by: Kartikay --- Makefile | 8 +++++++- scripts/lint-check.sh | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100755 scripts/lint-check.sh diff --git a/Makefile b/Makefile index 87f53735..8603dc73 100644 --- a/Makefile +++ b/Makefile @@ -11,4 +11,10 @@ unused-package-check: @tidy=$$(go mod tidy); \ if [ -n "$${tidy}" ]; then \ echo "go mod tidy checking failed!"; echo "$${tidy}"; echo; \ - fi \ No newline at end of file + fi +.PHONY: format_and_lint +format_and_lint: + @echo "------------------" + @echo "--> Formatting and linting the code" + @echo "------------------" + @bash scripts/lint-check.sh \ No newline at end of file diff --git a/scripts/lint-check.sh b/scripts/lint-check.sh new file mode 100755 index 00000000..1b0595fb --- /dev/null +++ b/scripts/lint-check.sh @@ -0,0 +1,2 @@ +find . -name '*.go' -type f -exec gofmt -s -w {} \; +golangci-lint run --enable goimports --enable gofmt --timeout 10m \ No newline at end of file