Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ashwch/precommit-vet-lint

A precommit hook that runs Golint and Vet on your staged go files.
https://github.com/ashwch/precommit-vet-lint

go-vet golang golint hooks pre-commit

Last synced: 3 months ago
JSON representation

A precommit hook that runs Golint and Vet on your staged go files.

Awesome Lists containing this project

README

        

Precommit-vet-lint
===

A precommit hook that runs on your staged Go file and reports errors returned by [Golint](https://github.com/golang/lint) and [Vet](https://golang.org/cmd/vet/).

### Installation
---

```bash
go get -u github.com/golang/lint/golint
go get -u github.com/ashwch/precommit-vet-lint
```

### Usage
---

Copy the contents of pre-commit file included with this repo in your `.git/hooks/pre-commit` file. Make sure the file has executable permissions.

### Example

```bash
$ git status
On branch master
Changes to be committed:
(use "git reset HEAD ..." to unstage)

new file: helpers.go
new file: precommit-vet-lint.go

Untracked files:
(use "git add ..." to include in what will be committed)

precommit-vet-lint

$ git commit -m "Added core files"
Running Golint and Vet...
Failed Following linting error(s) found:
helpers.go:14:1: exported function CheckError should have comment or be unexported
helpers.go:20:1: exported function GetStagedFiles should have comment or be unexported
helpers.go:48:1: exported function GetProjectBasePath should have comment or be unexported
helpers.go:53:1: exported function GetStagedContent should have comment or be unexported
helpers.go:60:1: exported function GetLintErrors should have comment or be unexported
helpers.go:69:1: exported function GetVetErrors should have comment or be unexported
helpers.go:83:6: exported type TempDir should have comment or be unexported
helpers.go:87:1: exported method TempDir.Create should have comment or be unexported
helpers.go:93:1: exported method TempDir.Close should have comment or be unexported.
```