From adf92ce5e091e8e50d4d853c7714ecda39cc9126 Mon Sep 17 00:00:00 2001 From: Prabhat Khera <91852476+prabhat-org@users.noreply.github.com> Date: Thu, 19 Jan 2023 12:11:09 +1300 Subject: [PATCH] fix golang ci linter prehook (#8359) --- golangci-lint.sh | 11 +++++++++++ lint-staged.config.js | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 golangci-lint.sh diff --git a/golangci-lint.sh b/golangci-lint.sh new file mode 100644 index 000000000..ee9fef358 --- /dev/null +++ b/golangci-lint.sh @@ -0,0 +1,11 @@ + +#!/bin/bash + +cd api +if golangci-lint run -c .golangci.yaml +then + echo "golangci-lint run successfully" +else + echo "golangci-lint run failed" + exit 1 +fi \ No newline at end of file diff --git a/lint-staged.config.js b/lint-staged.config.js index c8ddbc757..e0267a2a2 100644 --- a/lint-staged.config.js +++ b/lint-staged.config.js @@ -2,5 +2,5 @@ module.exports = { '*.(js|ts){,x}': 'eslint --cache --fix', '*.(ts){,x}': () => 'tsc --noEmit', '*.{js,ts,tsx,css,md,html,json}': 'prettier --write', - '*.go': 'golangci-lint run -c api/.golangci.yaml', + '*.go': 'bash golangci-lint.sh', };