-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
49 lines (38 loc) · 1.18 KB
/
Makefile
File metadata and controls
49 lines (38 loc) · 1.18 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
48
49
# Copyright © Paul Tötterman <[email protected]>. All rights reserved.
.PHONY: all
all: test urlredir
urlredir: main.go storage.go templates.go handlers.go errors.go
CGO_ENABLED=0 go build -tags netgo,osusergo,timetzdata \
-trimpath -ldflags '-s -w' -o $@
.PHONY: run
run: urlredir
./urlredir
.PHONY: test
test:
CGO_ENABLED=0 go test -short -shuffle=on -vet=all -v
.PHONY: test-all
test-all:
CGO_ENABLED=0 go test -shuffle=on -vet=all -v
.PHONY: cover
cover:
CGO_ENABLED=0 go test -coverprofile cover.out
CGO_ENABLED=0 go tool cover -html cover.out
.PHONY: lint
lint:
CGO_ENABLED=0 go tool golangci-lint run --default all \
--disable varnamelen,depguard,wsl,noinlineerr \
--enable wsl_v5
.PHONY: cloc
cloc:
@cloc .
@echo only tests
@cloc *_test.go
.PHONY: docker
docker:
docker build -t urlredir .
.PHONY: clean
clean:
rm -f urlredir cover.out
.PHONY: cleanschemas
cleanschemas:
@psql urlredir -c '\t on' -c '\timing off' -c "SELECT schema_name FROM information_schema.schemata where schema_name ILIKE 'test%%'" | tail -n +2 |while read -r schema; do if [ -z "$${schema}" ]; then continue; fi; psql urlredir -c "DROP SCHEMA \"$${schema}\" CASCADE"; done