-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use golangci-lint as linter and fix some linting bugs (#29)
use golangci-lint as linter and fix some linting bugs
- Loading branch information
1 parent
8a4367b
commit d417517
Showing
9 changed files
with
14 additions
and
68 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
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
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 |
---|---|---|
@@ -1,39 +1,2 @@ | ||
#!/bin/sh | ||
MAX_CYCLO=15 | ||
|
||
INEFFASSIGN_ERRORS=$(ineffassign pkg cmd) | ||
if [ -n "${INEFFASSIGN_ERRORS}" ]; then | ||
printf >&2 'ineffassign failed for the following files:\n%s\n' "${INEFFASSIGN_ERRORS}" | ||
exit 1 | ||
fi | ||
|
||
MISSPELL_ERRORS=$(misspell pkg/*go cmd/rabtap/*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 pkg/*go cmd/rabtap/*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 -s -l pkg/*go cmd/rabtap/*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 vet pkg/*go 2>&1 && go vet cmd/rabtap/*go 2>&1) | ||
if [ $? -ne 0 ]; 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 |