Skip to content

Commit

Permalink
chore: move lint targets to a sub Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
leovct committed Jul 3, 2023
1 parent b63b790 commit 488d8d7
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 30 deletions.
31 changes: 1 addition & 30 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
include scripts/lint.mk
include scripts/clients.mk
.DEFAULT_GOAL := help

Expand Down Expand Up @@ -60,36 +61,6 @@ simplecross: $(BUILD_DIR) ## Cross-compile go binaries without using CGO.
clean: ## Clean the binary folder.
$(RM) -r $(BUILD_DIR)

##@ 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.

##@ Test

.PHONY: test
Expand Down
29 changes: 29 additions & 0 deletions scripts/lint.mk
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.

0 comments on commit 488d8d7

Please sign in to comment.