aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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()
+}