summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2025-02-01 08:48:53 +0700
committerShulhan <ms@kilabit.info>2025-02-01 08:58:26 +0700
commitf04c347644db4dac89d8fe9e89a546b28aef1356 (patch)
treec7c355c1e3847230648fccacab599877a5360776
parent5057dfdb75b851254987ac1237f84cd4d7f54a02 (diff)
downloadasciidoctor-go-f04c347644db4dac89d8fe9e89a546b28aef1356.tar.xz
make: replace external linters with internal command gocheck
The fieldalignment and shadow is linter from golang.org/x/tools. This linters actually have an API that can be combined into a program, which provided by package "pakakeh.go/lib/goanalysis".
-rw-r--r--Makefile10
-rw-r--r--internal/cmd/gocheck/main.go17
2 files changed, 23 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index 30cdda6..315670e 100644
--- a/Makefile
+++ b/Makefile
@@ -1,24 +1,26 @@
## SPDX-FileCopyrightText: 2020 M. Shulhan <ms@kilabit.info>
## SPDX-License-Identifier: GPL-3.0-or-later
-.PHONY: all lint test-parser serve-doc
-
+.PHONY: all
all: test lint
+.PHONY: lint
lint:
- -fieldalignment ./...
- -shadow ./...
+ go run ./internal/cmd/gocheck ./...
go vet ./...
+.PHONY: test
test:
go test -coverprofile=cover.out ./...
go tool cover -html=cover.out -o cover.html
+.PHONY: test-parser
test-parser:
asciidoctor --attribute stylesheet! \
--out-file=testdata/test.exp.html \
testdata/test.adoc
go test -v -run=Open .
+.PHONY: serve-doc
serve-doc:
ciigo -address=127.0.0.1:31904 serve _doc/
diff --git a/internal/cmd/gocheck/main.go b/internal/cmd/gocheck/main.go
new file mode 100644
index 0000000..956e790
--- /dev/null
+++ b/internal/cmd/gocheck/main.go
@@ -0,0 +1,17 @@
+// SPDX-FileCopyrightText: 2024 M. Shulhan <ms@kilabit.info>
+//
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+// 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()
+}