From cb3db89b1c4bee10eec85a7fa1dbbd35fb347478 Mon Sep 17 00:00:00 2001 From: "Stanislav N. aka pztrn" Date: Sat, 26 Apr 2025 14:25:26 +0500 Subject: [PATCH] Remove GO111MODULE and update lint/test commands. (#1) Reviewed-on: https://code.pztrn.name/misc/pre-commit-hooks-golang/pulls/1 Co-authored-by: Stanislav N. aka pztrn Co-committed-by: Stanislav N. aka pztrn --- .pre-commit-hooks.yaml | 22 +++++++++++++--------- go-test-cover.sh | 3 +++ go-test-mod-cover.sh | 5 ----- golangci-lint-mod.sh | 5 ----- golangci-lint.sh | 3 +++ 5 files changed, 19 insertions(+), 19 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..c04145a 100644 --- a/.pre-commit-hooks.yaml +++ b/.pre-commit-hooks.yaml @@ -1,12 +1,16 @@ -- id: go-test-mod-cover - name: 'go-test-mod-cover' - entry: 'go-test-mod-cover.sh' +- id: go-test-cover + name: 'go-test-cover' + 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 -- id: golangci-lint-mod - name: 'golangci-lint-mod' - entry: 'golangci-lint-mod.sh' + files: .*.go" + always_run: true +- id: golangci-lint + name: 'golangci-lint' + 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" + always_run: true 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