-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
49 lines (35 loc) · 935 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
41
42
43
44
45
46
47
48
49
SHELL := /usr/bin/env bash
# The name of the executable (default is current directory name)
TARGET := $(shell echo $${PWD##*/})
# go source files, ignore vendor directory
SRC = $(shell find . -type f -name '*.go' -not -path "./vendor/*")
COMMIT := $(shell git rev-parse --short HEAD)
TODAY := $(shell date +%Y-%m-%d)
LDFLAGS=-ldflags "-X main.COMMIT=${COMMIT} -X main.DATE=${TODAY}"
# looks like abuse
.PHONY: all build obsdbuild clean fmt simplify test testcov testcovweb
all: fmt build test lint
build:
go build ${LDFLAGS}
obsdbuild:
GOOS=openbsd GOARCH=amd64 go build ${LDFLAGS} -o ${TARGET}.obsd
clean:
rm -f ${TARGET}
rm -f ${TARGET}.obsd
rm -f coverage.out
fmt:
gofmt -l -w ${SRC}
simplify:
gofmt -s -l -w ${SRC}
test:
go vet
go test -v
testcov:
go test -cover -v
testcovweb:
go test -coverprofile=coverage.out
go tool cover -html=coverage.out
rm -f coverage.out
lint:
golangci-lint run
shadow ./...