go-json/Makefile

40 lines
848 B
Makefile
Raw Normal View History

2021-03-18 11:33:09 +03:00
PKG := github.com/goccy/go-json
2021-02-03 17:33:28 +03:00
BIN_DIR := $(CURDIR)/bin
2021-03-18 11:33:09 +03:00
PKGS := $(shell go list ./... | grep -v internal/cmd)
COVER_PKGS := $(foreach pkg,$(PKGS),$(subst $(PKG),.,$(pkg)))
COMMA := ,
EMPTY :=
SPACE := $(EMPTY) $(EMPTY)
COVERPKG_OPT := $(subst $(SPACE),$(COMMA),$(COVER_PKGS))
2021-02-03 17:33:28 +03:00
$(BIN_DIR):
@mkdir -p $(BIN_DIR)
2021-01-16 16:16:26 +03:00
.PHONY: cover
cover:
2021-06-06 12:44:10 +03:00
go test -coverpkg=$(COVERPKG_OPT) -coverprofile=cover.out ./...
2021-01-16 16:16:26 +03:00
2021-01-16 16:18:44 +03:00
.PHONY: cover-html
2021-01-16 16:16:26 +03:00
cover-html: cover
go tool cover -html=cover.out
2021-02-03 17:33:28 +03:00
.PHONY: lint
lint: golangci-lint
golangci-lint run
golangci-lint: | $(BIN_DIR)
2021-02-03 17:43:14 +03:00
@{ \
set -e; \
GOLANGCI_LINT_TMP_DIR=$$(mktemp -d); \
cd $$GOLANGCI_LINT_TMP_DIR; \
go mod init tmp; \
GOBIN=$(BIN_DIR) go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.36.0; \
rm -rf $$GOLANGCI_LINT_TMP_DIR; \
}
2021-03-15 20:50:19 +03:00
.PHONY: generate
generate:
go generate ./internal/...