From f04c347644db4dac89d8fe9e89a546b28aef1356 Mon Sep 17 00:00:00 2001 From: Shulhan Date: Sat, 1 Feb 2025 08:48:53 +0700 Subject: 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". --- Makefile | 10 ++++++---- internal/cmd/gocheck/main.go | 17 +++++++++++++++++ 2 files changed, 23 insertions(+), 4 deletions(-) create mode 100644 internal/cmd/gocheck/main.go diff --git a/Makefile b/Makefile index 30cdda6..315670e 100644 --- a/Makefile +++ b/Makefile @@ -1,24 +1,26 @@ ## SPDX-FileCopyrightText: 2020 M. Shulhan ## 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 +// +// 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() +} -- cgit v1.3