Created
June 16, 2020 21:57
-
-
Save stevemcquaid/4df56990daaced764101f425667efa5f to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# Lint the Code (Run static-analysis | |
FROM builder as linter | |
WORKDIR /workspace | |
ARG GO111MODULE=on | |
# Install deps | |
RUN go get github.com/golangci/golangci-lint/cmd/[email protected] | |
RUN go get honnef.co/go/tools/cmd/[email protected] | |
# Fail if any files are needing to be gofmt'd | |
RUN fmtFiles=$(go fmt ./...); test -z $fmtFiles || (echo "**** Need to run go fmt on: $fmtFiles ****" && exit 1) | |
RUN go vet ./... | |
RUN golangci-lint run \ | |
--deadline=30m \ | |
--disable-all \ | |
--no-config \ | |
--issues-exit-code=1 \ | |
--enable=bodyclose \ | |
--enable=deadcode \ | |
--enable=dupl \ | |
--enable=errcheck \ | |
--enable=gocognit \ | |
--enable=goconst \ | |
--enable=gocyclo \ | |
--enable=gofmt \ | |
--enable=goimports \ | |
--enable=golint \ | |
--enable=gomodguard \ | |
--enable=gosec \ | |
--enable=govet \ | |
--enable=ineffassign \ | |
--enable=interfacer \ | |
--enable=megacheck \ | |
--enable=misspell \ | |
--enable=nakedret \ | |
--enable=prealloc \ | |
--enable=rowserrcheck \ | |
--enable=staticcheck \ | |
--enable=structcheck \ | |
--enable=stylecheck \ | |
--enable=typecheck \ | |
--enable=unconvert \ | |
--enable=unparam \ | |
--enable=varcheck \ | |
--enable=whitespace | |
RUN staticcheck -fail -tests -checks all ./... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment