From b57b85c3fef87a0e8b1920aecd2c006f351709c8 Mon Sep 17 00:00:00 2001 From: "Stanislav N. aka pztrn" Date: Sat, 26 Apr 2025 14:20:44 +0500 Subject: [PATCH 1/3] Fix config. --- .pre-commit-hooks.yaml | 12 +++++++----- go-test-cover.sh | 3 +++ go-test-mod-cover.sh | 5 ----- golangci-lint-mod.sh | 5 ----- golangci-lint.sh | 3 +++ 5 files changed, 13 insertions(+), 15 deletions(-) create mode 100755 go-test-cover.sh delete mode 100755 go-test-mod-cover.sh delete mode 100755 golangci-lint-mod.sh create mode 100755 golangci-lint.sh diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml index faed2bd..2d4567a 100644 --- a/.pre-commit-hooks.yaml +++ b/.pre-commit-hooks.yaml @@ -1,12 +1,14 @@ - id: go-test-mod-cover name: 'go-test-mod-cover' - entry: 'go-test-mod-cover.sh' + entry: 'go-test-cover.sh' language: 'script' - description: 'Run go test in module mode (GO111MODULE=on) with coverage report' + description: 'Run go test in module mode with coverage report.' pass_filenames: false + files: "*.go" - id: golangci-lint-mod name: 'golangci-lint-mod' - entry: 'golangci-lint-mod.sh' + entry: 'golangci-lint.sh' language: 'script' - description: 'Run golangci-lint in module mode (GO111MODULE=on)' - pass_filenames: false \ No newline at end of file + description: 'Run golangci-lint in module mode.' + pass_filenames: false + files: "*.go" diff --git a/go-test-cover.sh b/go-test-cover.sh new file mode 100755 index 0000000..6834cda --- /dev/null +++ b/go-test-cover.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env sh + +$(which go) test -cover diff --git a/go-test-mod-cover.sh b/go-test-mod-cover.sh deleted file mode 100755 index a907769..0000000 --- a/go-test-mod-cover.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env sh - -export GO111MODULE=on - -$(which go) test -cover ./... \ No newline at end of file diff --git a/golangci-lint-mod.sh b/golangci-lint-mod.sh deleted file mode 100755 index c1fd7b5..0000000 --- a/golangci-lint-mod.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env sh - -export GO111MODULE=on - -$(which golangci-lint) run ./... \ No newline at end of file diff --git a/golangci-lint.sh b/golangci-lint.sh new file mode 100755 index 0000000..434dbe8 --- /dev/null +++ b/golangci-lint.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env sh + +$(which golangci-lint) run -- 2.47.2 From da02b8d4303bc153214e7c941dba1e4241b2ca66 Mon Sep 17 00:00:00 2001 From: "Stanislav N. aka pztrn" Date: Sat, 26 Apr 2025 14:22:33 +0500 Subject: [PATCH 2/3] Fix regexp. --- .pre-commit-hooks.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml index 2d4567a..d436ff7 100644 --- a/.pre-commit-hooks.yaml +++ b/.pre-commit-hooks.yaml @@ -4,11 +4,11 @@ language: 'script' description: 'Run go test in module mode with coverage report.' pass_filenames: false - files: "*.go" + files: .*.go" - id: golangci-lint-mod name: 'golangci-lint-mod' entry: 'golangci-lint.sh' language: 'script' description: 'Run golangci-lint in module mode.' pass_filenames: false - files: "*.go" + files: .*.go" -- 2.47.2 From 31d7f5e774ec8b1354d603ea97a621f20265af89 Mon Sep 17 00:00:00 2001 From: "Stanislav N. aka pztrn" Date: Sat, 26 Apr 2025 14:23:51 +0500 Subject: [PATCH 3/3] More fixes. --- .pre-commit-hooks.yaml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml index d436ff7..c04145a 100644 --- a/.pre-commit-hooks.yaml +++ b/.pre-commit-hooks.yaml @@ -1,14 +1,16 @@ -- id: go-test-mod-cover - name: 'go-test-mod-cover' +- id: go-test-cover + name: 'go-test-cover' entry: 'go-test-cover.sh' language: 'script' description: 'Run go test in module mode with coverage report.' pass_filenames: false files: .*.go" -- id: golangci-lint-mod - name: 'golangci-lint-mod' + always_run: true +- id: golangci-lint + name: 'golangci-lint' entry: 'golangci-lint.sh' language: 'script' description: 'Run golangci-lint in module mode.' pass_filenames: false files: .*.go" + always_run: true -- 2.47.2