lens @ 6e84441dab0a2b89869e33d7e89d14189d9b67c0

 1BIN=img
 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
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		--root=${HOME}
26
27sass:
28	@mkdir -p static
29	sassc \
30		-I scss scss/main.scss static/main.css \
31		--style compressed
32
33test: test.unit test.integration
34
35test.all: gci test.unit test.integration lint
36
37test.integration:
38	$(GO_TEST) -tags=integration ./...
39
40test.unit:
41	$(GO_TEST) -tags=unit ./...
42
43gen:
44	go run -v \
45		./cmd/ggen/...
46
47cover.%:
48	$(GO_TEST) \
49		-tags=$* \
50		-coverprofile=bin/cover \
51		./...
52	go tool cover \
53		-html=bin/cover \
54		-o bin/cover.html
55	echo "open bin/cover.html"
56
57lint:
58	golangci-lint run \
59	--fix \
60	--config golangci.yml \
61	--verbose \
62	./...
63
64fix: gci alignment
65
66gci:
67	find . \
68		-type f \
69		-name "*.go" \
70		-not -path "./vendor/*" \
71		-exec gci write -s standard -s default -s "prefix(git.sr.ht/~gabrielgio/img)" {} +
72
73alignment:
74	betteralign -apply ./...