File: Makefile

package info (click to toggle)
golang-gopkg-lxc-go-lxc.v2 0.0%2Bgit20220627.ad3d9f7-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bookworm-backports
  • size: 428 kB
  • sloc: ansic: 572; makefile: 77
file content (62 lines) | stat: -rw-r--r-- 1,743 bytes parent folder | download | duplicates (2)
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
50
51
52
53
54
55
56
57
58
59
60
61
62
NO_COLOR=\033[0m
OK_COLOR=\033[0;32m

all: format vet lint

format:
	@echo "$(OK_COLOR)==> Formatting the code $(NO_COLOR)"
	@gofmt -s -w *.go
	@goimports -w *.go || true

test-privileged:
	@echo "$(OK_COLOR)==> Running tests for privileged user $(NO_COLOR)"
	@sudo `which go` test -v -coverprofile=/tmp/priv.out
	@sudo `which go` test -tags static_build -v -coverprofile=/tmp/priv.out

test-privileged-race:
	@echo "$(OK_COLOR)==> Running tests with -race flag for privileged user $(NO_COLOR)"
	@sudo `which go` test -race -v
	@sudo `which go` test -tags static_build -race -v

test:
	@echo "$(OK_COLOR)==> Running tests for unprivileged user $(NO_COLOR)"
	@`which go` test -v -coverprofile=/tmp/unpriv.out
	@`which go` test -tags static_build -v -coverprofile=/tmp/unpriv.out

test-race:
	@echo "$(OK_COLOR)==> Running tests with -race flag for unprivileged user $(NO_COLOR)"
	@`which go` test -race -v
	@`which go` test -tags static_build -race -v

cover:
	@echo "$(OK_COLOR)==> Running cover for privileged user $(NO_COLOR)"
	@`which go` tool cover -func=/tmp/priv.out || true
	@echo "$(OK_COLOR)==> Running cover for unprivileged user $(NO_COLOR)"
	@`which go` tool cover -func=/tmp/unpriv.out || true

doc:
	@`which go` doc github.com/lxc/go-lxc | less

vet:
	@echo "$(OK_COLOR)==> Running go vet $(NO_COLOR)"
	@`which go` vet .

lint:
	@echo "$(OK_COLOR)==> Running golint $(NO_COLOR)"
	@`which golint` . || true

escape-analysis:
	@`which go` build -gcflags -m

ctags:
	@ctags -R --languages=c,go

update-gomod:
	go get -t -v -d -u ./...
	go mod tidy

scope:
	@echo "$(OK_COLOR)==> Exported container calls in container.go $(NO_COLOR)"
	@/bin/grep -E "\bc+\.([A-Z])\w+" container.go || true

.PHONY: all format test doc vet lint ctags