Initial commit with golangci-lint.

This commit is contained in:
Stanislav Nikitin 2020-05-12 22:16:07 +05:00
commit 21f4717bcd
No known key found for this signature in database
GPG Key ID: 106900B32F8192EE
5 changed files with 52 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.idea

6
.pre-commit-hooks.yaml Normal file
View File

@ -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

20
LICENSE Normal file
View File

@ -0,0 +1,20 @@
Copyright (c) 2020 by Stanislav Nikitin <pztrn@pztrn.name>
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.

20
README.md Normal file
View File

@ -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``)

5
golangci-lint-mod.sh Normal file
View File

@ -0,0 +1,5 @@
#!/usr/bin/env sh
export GO111MODULE=on
$(which golangci-lint) run