-
Notifications
You must be signed in to change notification settings - Fork 13
/
Makefile
40 lines (31 loc) · 903 Bytes
/
Makefile
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
SHELL := /bin/bash -euo pipefail
TIMEOUT := 1s
GOFLAGS := -mod=vendor
PKGS := go list ./... | grep -v pkg/http
TARGET := netramesh
.PHONY: deps
deps:
@go mod tidy && go mod vendor && go mod verify
.PHONY: update
update:
@go get -d -mod= -u
.PHONY: format
format:
@goimports -local golang_org,github.com/Lookyan/netramesh -ungroup -w ./cmd/ ./internal/ ./pkg/
.PHONY: test
test:
@$(PKGS) | xargs -I {} go test -race -timeout $(TIMEOUT) {}
.PHONY: test-with-coverage
test-with-coverage:
@$(PKGS) | xargs -I {} sh -c "go test -cover -timeout $(TIMEOUT) {} | column -t | sort -r"
.PHONY: build
build:
for target_os in "darwin" "linux"; do \
GOOS=$$target_os go build -o ./bin/$(TARGET)_$$target_os ./cmd ;\
done
.PHONY: docker-build
docker-build:
@docker build -f Dockerfile \
-t netramesh:latest \
--force-rm --no-cache --pull --rm \
.