-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathMakefile
More file actions
55 lines (39 loc) · 1.19 KB
/
Makefile
File metadata and controls
55 lines (39 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
APP_NAME ?= nctl
# try getconf (linux / macos), getconf (BSD), nproc, then fallback to 1
NPROCS := $(shell getconf _NPROCESSORS_ONLN 2>/dev/null || getconf NPROCESSORS_ONLN 2>/dev/null || nproc 2>/dev/null || echo 1)
MAKEFLAGS += --jobs=$(NPROCS)
.PHONY: all build test clean lint update help
all: build
build:
GITHUB_REPOSITORY=ninech/nctl goreleaser build --clean --snapshot --single-target
test:
go test -race ./...
lint: mod-tidy vet staticcheck golangci-lint modernize govulncheck
lint-fix:
go mod tidy
golangci-lint run --fix
go fix ./...
$(MAKE) lint
mod-tidy:
go mod tidy -diff
vet:
go vet ./...
golangci-lint:
golangci-lint run
staticcheck:
go run honnef.co/go/tools/cmd/staticcheck@latest ./...
modernize:
go fix -diff ./... | awk '{print} /\S/ {found=1} END {if (found) exit 1}'
govulncheck:
go run golang.org/x/vuln/cmd/govulncheck@latest ./...
update:
go get -v -u ./... && go mod tidy
clean:
rm -rf dist/
help:
@echo "make # Build $(APP_NAME)"
@echo "make test # Run tests"
@echo "make lint-fix # Run linters and try fix issues"
@echo "make lint # Run linters"
@echo "make update # Update dependencies"
@echo "make clean # Remove built app"