-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
31 lines (24 loc) · 789 Bytes
/
Makefile
File metadata and controls
31 lines (24 loc) · 789 Bytes
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
VERSION := $(shell git describe --tags --always 2>/dev/null || echo "dev")
COMMIT := $(shell git rev-parse HEAD 2>/dev/null || echo "unknown")
DATE := $(shell date -u)
LDFLAGS := -ldflags "-X 'lintree/internal/version.Version=$(VERSION)' -X 'lintree/internal/version.Commit=$(COMMIT)' -X 'lintree/internal/version.Date=$(DATE)'"
.PHONY: build install test clean lint run
build:
go build $(LDFLAGS) -o lintree .
install:
go install $(LDFLAGS) .
test:
go test ./...
clean:
rm -f lintree
rm -rf dist/
lint:
@if command -v golangci-lint >/dev/null 2>&1; then \
golangci-lint run ./...; \
else \
echo "golangci-lint not found. Install it: https://golangci-lint.run/welcome/install/"; \
echo "Falling back to go vet..."; \
go vet ./...; \
fi
run: build
./lintree $(ARGS)