-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
47 lines (35 loc) · 1.08 KB
/
Makefile
File metadata and controls
47 lines (35 loc) · 1.08 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
SHELL := /bin/bash
.SHELLFLAGS := -eu -o pipefail -c
MAKEFLAGS += --warn-undefined-variables --no-builtin-rules -j
.SUFFIXES:
.DELETE_ON_ERROR:
.DEFAULT_GOAL := build
.PHONY: build test lint clean install vet install-tools check modernize fmt
BINARY := wt
GO := go
VERSION := dev
COMMIT := $(shell git rev-parse --short HEAD 2>/dev/null || echo "none")$(shell git diff --quiet 2>/dev/null || echo "-dirty")
DATE := $(shell date -u '+%Y-%m-%d_%H:%M:%S')
LDFLAGS := -X main.version=$(VERSION) -X main.commit=$(COMMIT) -X main.date=$(DATE)
build:
$(GO) build -ldflags "$(LDFLAGS)" -o $(BINARY) ./cmd/wt
@[ -e ~/.local/bin/$(BINARY) ] || ln -sf $(CURDIR)/$(BINARY) ~/.local/bin/$(BINARY)
modernize:
modernize -fix ./...
vet:
$(GO) vet ./...
fmt: modernize
golangci-lint fmt
lint:
golangci-lint config verify
@./backpressure/no-lint-suppress.sh
golangci-lint run --fix ./...
test:
$(GO) test -race ./...
clean:
rm -f $(BINARY)
install:
$(GO) install ./cmd/wt
install-tools:
$(GO) install golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@latest
check: vet lint test