-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: move lint targets to a sub Makefile
- Loading branch information
Showing
2 changed files
with
30 additions
and
30 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
##@ Lint | ||
|
||
# Add missing and remove unused modules. | ||
.PHONY: tidy | ||
tidy: | ||
go mod tidy | ||
|
||
# Run `go fmt` against code. | ||
.PHONY: fmt | ||
fmt: | ||
go fmt ./... | ||
|
||
# Run `go vet` and `shadow` (which reports shadowed variables) against code. | ||
# https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/shadow | ||
# `go install golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow@latest` | ||
.PHONY: vet | ||
vet: | ||
go vet ./... | ||
shadow ./... | ||
|
||
# Run `golangci-lint` against code. | ||
# `golangci-lint` runs `gofmt`, `govet`, `staticcheck` and other linters. | ||
# https://golangci-lint.run/usage/install/#local-installation | ||
.PHONY: golangci-lint | ||
golangci-lint: | ||
golangci-lint run --fix --timeout 5m | ||
|
||
.PHONY: lint | ||
lint: tidy vet golangci-lint ## Run linters. |