diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..27919cb --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +/vendor/ +/bin/ +/.vscode/ diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..200dbde --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,39 @@ +run: + deadline: 2m + +linters: + disable-all: true + fast: false + enable: + - bodyclose + - deadcode + - depguard + - dupl + - goconst + - gocyclo + - gofmt + - goimports + - golint + - gosec + - gosimple + - govet + - ineffassign + - interfacer + - lll + - misspell + - nakedret + - staticcheck + - structcheck + - typecheck + - unconvert + - unparam + - unused + - varcheck + +linters-settings: + lll: + line-length: 110 + goimports: + local-prefixes: "github.com/shaj13/go-guardian/" +issues: + exclude-use-default: false diff --git a/Makefile b/Makefile index 4a90409..a671294 100644 --- a/Makefile +++ b/Makefile @@ -16,4 +16,11 @@ cover: clean GOFLAGS=-mod=vendor go test ./... -v -cover -coverprofile=${PWD}/cover/coverage.out deploy-cover: - goveralls -coverprofile=${PWD}/cover/coverage.out -service=circle-ci -repotoken=$$COVERALLS_TOKEN \ No newline at end of file + goveralls -coverprofile=${PWD}/cover/coverage.out -service=circle-ci -repotoken=$$COVERALLS_TOKEN + +lint: + ./bin/golangci-lint run -c .golangci.yml ./... + +lint-fix: + ./bin/golangci-lint run -c .golangci.yml ./... --fix + ./bin/golangci-lint run -c .golangci.yml ./... --fix