|
1 | | -TAGS ?= "sqlite" |
2 | | -GO_BIN ?= go |
| 1 | +TAGS ?= sqlite,integration |
| 2 | +GO_BIN ?= go |
3 | 3 |
|
4 | | -install: |
5 | | - packr2 |
6 | | - $(GO_BIN) install -v . |
| 4 | +LINT_TARGET ?= ./... |
| 5 | +LINT_SKIP_DIRS ?= "internal" |
7 | 6 |
|
8 | | -deps: |
9 | | - $(GO_BIN) get github.com/gobuffalo/release |
10 | | - $(GO_BIN) get github.com/gobuffalo/packr/v2 |
11 | | - $(GO_BIN) get -tags ${TAGS} -t ./... |
12 | | - $(GO_BIN) mod tidy |
| 7 | +LINTERS_B = govet,revive,goimports,unused,typecheck,ineffassign,misspell,nakedret,unconvert,megacheck |
| 8 | +LINTERS = $(LINTERS_B),gocognit,gocyclo,misspell |
| 9 | +MORE_LINTERS = $(LINTERS),errorlint,goerr113,forcetypeassert,gosec |
13 | 10 |
|
14 | | -build: |
15 | | - packr2 |
16 | | - $(GO_BIN) build -v . |
| 11 | +DEPRECATED_LINTERS = deadcode,golint,maligned,ifshort,scopelint,interfacer,varcheck,nosnakecase,structcheck |
| 12 | +NEVER_LINTERS = godox,forbidigo,varnamelen,paralleltest,testpackage |
| 13 | +DISABLED_LINTERS = $(DEPRECATED_LINTERS),$(NEVER_LINTERS),exhaustivestruct,ireturn,gci,gochecknoglobals,wrapcheck |
| 14 | +DISABLED_LINTERS_TEST = $(DISABLED_LINTERS),nolintlint,wsl,goerr113,forcetypeassert,errcheck,goconst,scopelint |
17 | 15 |
|
18 | 16 | test: |
19 | | - packr2 |
20 | | - $(GO_BIN) test -tags ${TAGS} ./... |
21 | | - |
22 | | -ci-test: deps |
23 | | - $(GO_BIN) test -tags ${TAGS} -race ./... |
| 17 | + $(GO_BIN) test -tags ${TAGS} -cover -race ./... |
24 | 18 |
|
25 | 19 | lint: |
26 | | - gometalinter --vendor ./... --deadline=1m --skip=internal |
27 | | - |
28 | | -update: |
29 | | - $(GO_BIN) get -u -tags ${TAGS} |
30 | | - $(GO_BIN) mod tidy |
31 | | - packr2 |
32 | | - make test |
33 | | - make install |
34 | | - $(GO_BIN) mod tidy |
35 | | - |
36 | | -release-test: |
37 | | - $(GO_BIN) test -tags ${TAGS} -race ./... |
| 20 | + # go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest |
| 21 | + golangci-lint run --disable-all --enable $(LINTERS) \ |
| 22 | + --skip-dirs $(LINT_SKIP_DIRS) \ |
| 23 | + $(LINT_TARGET) |
| 24 | + golangci-lint run --disable-all --enable $(MORE_LINTERS) \ |
| 25 | + --skip-dirs $(LINT_SKIP_DIRS) \ |
| 26 | + --tests=false $(LINT_TARGET) |
| 27 | + |
| 28 | +lint-harder: |
| 29 | + golangci-lint run --enable-all --disable $(DISABLED_LINTERS) \ |
| 30 | + --skip-dirs $(LINT_SKIP_DIRS) \ |
| 31 | + --exclude-use-default=false \ |
| 32 | + --tests=false $(LINT_TARGET) |
| 33 | + golangci-lint run --enable-all --disable $(DISABLED_LINTERS_TEST) \ |
| 34 | + --skip-dirs $(LINT_SKIP_DIRS) \ |
| 35 | + --exclude-use-default=false \ |
| 36 | + $(LINT_TARGET) |
38 | 37 |
|
39 | | -release: |
40 | | - release -y -f version.go |
0 commit comments