diff options
| author | Shulhan <ms@kilabit.info> | 2026-01-06 15:47:15 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2026-01-06 15:47:15 +0700 |
| commit | 08a4462c66fab99e5e66b465f053291c438dd0e0 (patch) | |
| tree | ba8b3d2f9b8fbcdcc17b4d237cf31b2618fa09a9 | |
| parent | 7ba3a36f94b5dd274ecc932895a05072e6e0080c (diff) | |
| download | spdxconv-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-- | .gitignore | 2 | ||||
| -rw-r--r-- | Makefile | 17 | ||||
| -rw-r--r-- | internal/cmd/gocheck/main.go | 16 |
3 files changed, 35 insertions, 0 deletions
@@ -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() +} |
