Skip to content

Commit 2d448e0

Browse files
committed
Add .gitignore and Makefile
1 parent 0872430 commit 2d448e0

File tree

2 files changed

+61
-0
lines changed

2 files changed

+61
-0
lines changed

.gitignore

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Binaries for programs and plugins
2+
*.exe
3+
*.exe~
4+
*.dll
5+
*.so
6+
*.dylib
7+
8+
# Test binary, built with `go test -c`
9+
*.test
10+
11+
# Output of the go coverage tool, specifically when used with LiteIDE
12+
*.out
13+
14+
# Dependency directories (remove the comment below to include it)
15+
# vendor/
16+
#
17+
bin/
18+
dist/

Makefile

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
NAME = pingu
2+
BIN := bin/$(NAME)
3+
4+
# version e.g. v0.0.1
5+
VERSION := $(shell git describe --tags --abbrev=0 | tr -d "v")
6+
# commit hash of HEAD e.g. 3a913f
7+
REVISION := $(shell git rev-parse --short HEAD)
8+
9+
LDFLAGS := -w \
10+
-s \
11+
-X "main.appVersion=$(VERSION)" \
12+
-X "main.appRevision=$(REVISION)"
13+
14+
COVERAGE_OUT := .test/cover.out
15+
COVERAGE_HTML := .test/cover.html
16+
17+
.PHONY: build
18+
build:
19+
go build -ldflags "$(LDFLAGS)" -o $(BIN)
20+
21+
.PHONY: fmt
22+
fmt:
23+
go fmt
24+
25+
.PHONY: lint
26+
lint:
27+
staticcheck ./...
28+
29+
.PHONY: test
30+
test:
31+
mkdir -p .test
32+
go test -coverprofile=$(COVERAGE_OUT) ./...
33+
34+
.PHONY: coverage
35+
coverage:
36+
go tool cover -html=$(COVERAGE_OUT) -o $(COVERAGE_HTML)
37+
38+
.PHONY: clean
39+
clean:
40+
rm $(BIN)
41+
rm $(COVERAGE_OUT)
42+
rm $(COVERAGE_HTML)
43+

0 commit comments

Comments
 (0)