File tree Expand file tree Collapse file tree 1 file changed +20
-4
lines changed Expand file tree Collapse file tree 1 file changed +20
-4
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,8 @@ GOLANGCI_LINT = go tool -modfile tools/go.mod github.com/golangci/golangci-lint/
3
3
4
4
VERSION ?= $(shell git describe --always --abbrev=7)
5
5
6
+ MODERNIZE_VERSION ?= 0.18.1
7
+
6
8
.PHONY : all
7
9
all : build
8
10
@@ -34,12 +36,26 @@ vet: ## Run go vet against code.
34
36
go vet ./...
35
37
36
38
.PHONY : lint
37
- lint : # # Run golangci-lint over the codebase.
38
- ${GOLANGCI_LINT} run ./... --timeout 5m -v ${GOLANGCI_LINT_EXTRA_ARGS}
39
+ lint : golangci-lint modernize
39
40
40
41
.PHONY : lint-fix
41
- lint-fix : GOLANGCI_LINT_EXTRA_ARGS := --fix
42
- lint-fix : lint # # Run golangci-lint over the codebase and run auto-fixers if supported by the linter
42
+ lint-fix : golangci-lint-fix modernize-fix
43
+
44
+ .PHONY : golangci-lint
45
+ golangci-lint : # # Run golangci-lint over the codebase.
46
+ ${GOLANGCI_LINT} run ./... --timeout 5m -v ${GOLANGCI_LINT_EXTRA_ARGS}
47
+
48
+ .PHONY : golangci-lint-fix
49
+ golangci-lint-fix : GOLANGCI_LINT_EXTRA_ARGS := --fix
50
+ golangci-lint-fix : golangci-lint # # Run golangci-lint over the codebase and run auto-fixers if supported by the linter
51
+
52
+ .PHONY : modernize
53
+ modernize : # # Run modernize on the codebase.
54
+ go run golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@v${MODERNIZE_VERSION} -diff ./...
55
+
56
+ .PHONY : modernize-fix
57
+ modernize-fix : # # Run modernize on the codebase and apply fixes.
58
+ go run golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@v${MODERNIZE_VERSION} -fix ./...
43
59
44
60
.PHONY : test
45
61
test : fmt vet unit # # Run tests.
You can’t perform that action at this time.
0 commit comments