commit 21f4717bcdcacec072370c303a34687eadd59c95 Author: Stanislav N. aka pztrn Date: Tue May 12 22:16:07 2020 +0500 Initial commit with golangci-lint. diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..723ef36 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.idea \ No newline at end of file diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml new file mode 100644 index 0000000..afe23c3 --- /dev/null +++ b/.pre-commit-hooks.yaml @@ -0,0 +1,6 @@ +- id: golangci-lint-mod + name: 'golangci-lint-mod' + entry: 'golangci-lint-mod.sh' + language: 'script' + description: 'Run golangci-lint in module mode (GO111MODULE=on)' + pass_filenames: false \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..b9daf65 --- /dev/null +++ b/LICENSE @@ -0,0 +1,20 @@ +Copyright (c) 2020 by Stanislav Nikitin + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..817d35d --- /dev/null +++ b/README.md @@ -0,0 +1,20 @@ +# pre-commit hooks for golang + +This repository contains [pre-commit](https://pre-commit.com) hooks for modern Golang developers. + +## Using + +Add this to your ``.pre-commit-config.yaml``: + +```yaml +repos: + - repo: https://sources.dev.pztrn.name/pztrn/pre-commit-hooks-golang + rev: master + hooks: + - id: golangci-lint-mod + ... +``` + +## Hooks list + +* ``golangci-lint-mod`` - executes ``golangci-lint`` in module mode (``GO111MODULES=on``) \ No newline at end of file diff --git a/golangci-lint-mod.sh b/golangci-lint-mod.sh new file mode 100644 index 0000000..d10c0b5 --- /dev/null +++ b/golangci-lint-mod.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env sh + +export GO111MODULE=on + +$(which golangci-lint) run \ No newline at end of file