lens @ 24c121a9ef229870f54de487de01c15a15ebbff1

 1BIN=lens
 2OUT=./bin/$(BIN)
 3SERVER=./cmd/server/main.go
 4
 5GO_TEST=go test -v -timeout 100ms -shuffle on -parallel `nproc`
 6GO_BUILD=go build -v -ldflags '-w -s'
 7GO_RUN=go run -v
 8
 9all: build
10
11build: sass tmpl
12	$(GO_BUILD) -o $(OUT) $(SERVER)
13
14compress: build
15	upx -1 $(OUT)
16
17compress_into_oblivion: build
18	upx --best --ultra-brute $(OUT)
19
20run: sass
21	$(GO_RUN) $(SERVER) \
22		--log-level error \
23		--aes-key=6368616e676520746869732070617373 \
24		--cache-path=${HOME}/.thumb
25
26sass:
27	@mkdir -p static
28	sassc \
29		-I scss scss/main.scss static/main.css \
30		--style compressed
31
32tmpl:
33	cd ./templates && \
34	qtc *
35
36test: test.unit test.integration
37
38test.all: gci test.unit test.integration lint
39
40test.integration:
41	$(GO_TEST) -tags=integration ./...
42
43test.unit:
44	$(GO_TEST) -tags=unit ./...
45
46gen:
47	go run -v \
48		./cmd/ggen/...
49
50cover.%:
51	$(GO_TEST) \
52		-tags=$* \
53		-coverprofile=bin/cover \
54		./...
55	go tool cover \
56		-html=bin/cover \
57		-o bin/cover.html
58	echo "open bin/cover.html"
59
60lint:
61	golangci-lint run \
62	--fix \
63	--config golangci.yml \
64	--verbose \
65	./...
66
67fix: gci alignment
68
69gci:
70	find . \
71		-type f \
72		-name "*.go" \
73		-not -path "./vendor/*" \
74		-exec gci write -s standard -s default -s "prefix(git.sr.ht/~gabrielgio/img)" {} +
75
76alignment:
77	betteralign -apply ./...