File tree Expand file tree Collapse file tree 2 files changed +24
-6
lines changed Expand file tree Collapse file tree 2 files changed +24
-6
lines changed Original file line number Diff line number Diff line change 11# pre-commit-golang
2+
23Golang pre-commit hooks for http://pre-commit.com/
4+
35## install
6+
47you need first to install [ pre-commit] ( https://pre-commit.com/#install )
8+
59```
610brew install pre-commit
711```
12+
813install pre-commit into your git repo
14+
915```
1016pre-commit install
1117```
18+
1219## Usage
20+
1321Add a file named ` .pre-commit-config.yaml ` into the root directory of your repository
22+
1423``` yaml
1524repos :
1625 - repo : https://github.com/Bahjat/pre-commit-golang
17- rev : v1.0.0
26+ rev : v1.0.1
1827 hooks :
1928 - id : go-fmt-import
2029 - id : go-vet
@@ -24,20 +33,21 @@ repos:
2433 - id : go-err-check # requires github.com/kisielk/errcheck
2534 - id : go-static-check # install https://staticcheck.io/docs/
2635 - id : golangci-lint # requires github.com/golangci/golangci-lint
36+ args : [--config=.github/linters/.golangci.yml] # optional
2737` ` `
38+
2839## Contributing
40+
2941- Fork it
3042- Create your feature branch ` git checkout -b my-new-feature`
3143- Commit your changes `git commit -am 'Add some feature'`
3244- Push to the branch `git push origin my-new-feature`
3345- Create new Pull Request
3446
3547# # Credits
36- This repo is inspired by [dnephin/pre-commit-golang](https://github.com/dnephin/pre-commit-golang)
3748
38- # # Contributors
39-
40- 
49+ This repo is inspired by [dnephin/pre-commit-golang](https://github.com/dnephin/pre-commit-golang)
4150
4251# # Finally
52+
4353If you like this hooks please give a star
Original file line number Diff line number Diff line change 11#! /bin/sh
22
3- ERRS=$( golangci-lint run --new-from-rev=" $( git rev-parse HEAD) " )
3+ CONFIG_FILE=" $1 "
4+
5+ if ! command -v golangci-lint 2>&1 /dev/null
6+ then
7+ echo " golangci-lint could not be found"
8+ exit
9+ fi
10+
11+ ERRS=$( golangci-lint run --new-from-rev=" $( git rev-parse HEAD) " " $CONFIG_FILE " )
412
513if [ -n " ${ERRS} " ]; then
614 echo " ${ERRS} "
You can’t perform that action at this time.
0 commit comments