summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2026-01-06 15:47:15 +0700
committerShulhan <ms@kilabit.info>2026-01-06 15:47:15 +0700
commit08a4462c66fab99e5e66b465f053291c438dd0e0 (patch)
treeba8b3d2f9b8fbcdcc17b4d237cf31b2618fa09a9
parent7ba3a36f94b5dd274ecc932895a05072e6e0080c (diff)
downloadspdxconv-08a4462c66fab99e5e66b465f053291c438dd0e0.tar.xz
all: add common make tasks
The "lint" task run the linters, and the "test" run all the test and generate the coverage (without CGO). The default task, run lint and test tasks.
-rw-r--r--.gitignore2
-rw-r--r--Makefile17
-rw-r--r--internal/cmd/gocheck/main.go16
3 files changed, 35 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index 3782838..c084787 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,4 @@
+_coverage/
cover.html
cover.out
+cover.txt
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..875c380
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,17 @@
+# SPDX-License-Identifier: GPL-3.0-only
+# SPDX-FileCopyrightText: 2025 M. Shulhan <ms@kilabit.info>
+
+.PHONY: all
+all: lint test
+
+.PHONY: lint
+lint:
+ go vet ./...
+ go run ./internal/cmd/gocheck ./...
+
+.PHONY: test
+test:
+ mkdir -p _coverage
+ go test -cover ./... -test.gocoverdir=_coverage
+ go tool covdata textfmt -i=_coverage -o cover.txt
+ go tool cover -html=cover.txt -o cover.html
diff --git a/internal/cmd/gocheck/main.go b/internal/cmd/gocheck/main.go
new file mode 100644
index 0000000..309bf20
--- /dev/null
+++ b/internal/cmd/gocheck/main.go
@@ -0,0 +1,16 @@
+// SPDX-License-Identifier: GPL-3.0-only
+// SPDX-FileCopyrightText: 2025 M. Shulhan <ms@kilabit.info>
+
+// Program gocheck implement go static analysis using [Analyzer] that are not
+// included in the default go vet.
+// See package [lib/goanalysis] for more information.
+//
+// [Analyzer]: https://pkg.go.dev/golang.org/x/tools/go/analysis#hdr-Analyzer
+// [lib/goanalysis]: https://pkg.go.dev/git.sr.ht/~shulhan/pakakeh.go/lib/goanalysis/
+package main
+
+import "git.sr.ht/~shulhan/pakakeh.go/lib/goanalysis"
+
+func main() {
+ goanalysis.Check()
+}