lens @ 438aa0e19b628923482dbc3fadcbb2e1ecfd5d7a

 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 sass
10
11build:
12	$(GO_BUILD) -o $(OUT) $(SERVER)
13
14run: sass
15	$(GO_RUN) $(SERVER) \
16		--log-level error \
17		--aes-key=6368616e676520746869732070617373 \
18		--root=${HOME}
19
20sass:
21	@mkdir -p static
22	sassc \
23		-I scss scss/main.scss static/main.css \
24		--style compressed
25
26test: test.unit test.integration
27
28test.all: gci test.unit test.integration lint
29
30test.integration:
31	$(GO_TEST) -tags=integration ./...
32
33test.unit:
34	$(GO_TEST) -tags=unit ./...
35
36gen:
37	go run -v \
38		./cmd/ggen/...
39
40cover.%:
41	$(GO_TEST) \
42		-tags=$* \
43		-coverprofile=bin/cover \
44		./...
45	go tool cover \
46		-html=bin/cover \
47		-o bin/cover.html
48	echo "open bin/cover.html"
49
50lint:
51	golangci-lint run \
52	--fix \
53	--config golangci.yml \
54	--verbose \
55	./...
56
57gci:
58	find . \
59		-type f \
60		-name "*.go" \
61		-not -path "./vendor/*" \
62		-exec gci write -s standard -s default -s "prefix(git.sr.ht/~gabrielgio/img)" {} +