This repository has been archived by the owner on Nov 22, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
13 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module github.com/jandelgado/golang-ci-template | ||
|
||
go 1.12 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,2 @@ | ||
#!/bin/sh | ||
# inspired from https://github.com/streadway/amqp/blob/master/pre-commit | ||
|
||
MAX_CYCLO=15 | ||
|
||
INEFFASSIGN_ERRORS=$(ineffassign .) | ||
if [ -n "${INEFFASSIGN_ERRORS}" ]; then | ||
printf >&2 'ineffassign failed for the following files:\n%s\n' "${INEFFASSIGN_ERRORS}" | ||
exit 1 | ||
fi | ||
|
||
MISSPELL_ERRORS=$(misspell *go) | ||
if [ -n "${MISSPELL_ERRORS}" ]; then | ||
printf >&2 'misspell failed for the following files:\n%s\n' "${MISSPELL_ERRORS}" | ||
exit 1 | ||
fi | ||
|
||
GOCYCLO_ERRORS=$(gocyclo -over $MAX_CYCLO *go) | ||
if [ -n "${GOCYCLO_ERRORS}" ]; then | ||
printf >&2 'gocyclo failed for the following files:\n%s\n' "${GOCYCLO_ERRORS}" | ||
exit 1 | ||
fi | ||
|
||
GOFMT_FILES=$(gofmt -l *go) | ||
if [ -n "${GOFMT_FILES}" ]; then | ||
printf >&2 'gofmt failed for the following files:\n%s\n\nplease run "gofmt -w ." on your changes before committing.\n' "${GOFMT_FILES}" | ||
exit 1 | ||
fi | ||
|
||
GOLINT_ERRORS=$(golint ./... 2>&1 | grep -v "^vendor/") | ||
if [ -n "${GOLINT_ERRORS}" ]; then | ||
printf >&2 'golint failed for the following reasons:\n%s\n.\n' "${GOLINT_ERRORS}" | ||
exit 1 | ||
fi | ||
|
||
GOVET_ERRORS=$(go tool vet --all *.go 2>&1) | ||
if [ -n "${GOVET_ERRORS}" ]; then | ||
printf >&2 'go vet failed for the following reasons:\n%s\n\nplease run "go tool vet *.go" on your changes before committing.\n' "${GOVET_ERRORS}" | ||
exit 1 | ||
fi | ||
|
||
golangci-lint -E bodyclose,misspell,gocyclo,dupl,gofmt,golint,unconvert,goimports,depguard,gocritic,funlen,interfacer run |