aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2024-04-06 16:39:26 +0700
committerShulhan <ms@kilabit.info>2024-04-06 16:39:39 +0700
commit3c550af069f30bed846ac012457a88b65223306d (patch)
treee8e712360c8cd7bcf4955c1ae1424c2625138932
parent772747f4051085443b38db8fb8f01ada41e89fc5 (diff)
downloadkbbi-3c550af069f30bed846ac012457a88b65223306d.tar.xz
all: run test with coverage
Running "make test" now print and generate the coverage in text and HTML format.
-rw-r--r--.gitignore2
-rw-r--r--Makefile17
2 files changed, 15 insertions, 4 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..18aad36
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+/cover.html
+/cover.txt
diff --git a/Makefile b/Makefile
index d7ccb28..0735845 100644
--- a/Makefile
+++ b/Makefile
@@ -2,15 +2,24 @@
## Use of this source code is governed by a BSD-style
## license that can be found in the LICENSE file.
-.PHONY: all install
+.PHONY: all
+all: test lint install
-all: test check install
+COVER_TXT:=cover.txt
+COVER_HTML:=cover.html
+
+.PHONY: test
+test: CGO_ENABLED=1
test:
- go test -v ./...
+ go test -failfast -timeout=1m -race -coverprofile=$(COVER_TXT) ./...
+ go tool cover -html=$(COVER_TXT) -o $(COVER_HTML)
+
-check:
+.PHONY: lint
+lint:
golangci-lint run ./...
+.PHONY: install
install:
go install ./cmd/kamusku