...

Text file src/github.com/goccy/go-json/Makefile

Documentation: github.com/goccy/go-json

     1PKG := github.com/goccy/go-json
     2
     3BIN_DIR := $(CURDIR)/bin
     4PKGS := $(shell go list ./... | grep -v internal/cmd|grep -v test)
     5COVER_PKGS := $(foreach pkg,$(PKGS),$(subst $(PKG),.,$(pkg)))
     6
     7COMMA := ,
     8EMPTY :=
     9SPACE := $(EMPTY) $(EMPTY)
    10COVERPKG_OPT := $(subst $(SPACE),$(COMMA),$(COVER_PKGS))
    11
    12$(BIN_DIR):
    13	@mkdir -p $(BIN_DIR)
    14
    15.PHONY: cover
    16cover:
    17	go test -coverpkg=$(COVERPKG_OPT) -coverprofile=cover.out ./...
    18
    19.PHONY: cover-html
    20cover-html: cover
    21	go tool cover -html=cover.out
    22
    23.PHONY: lint
    24lint: golangci-lint
    25	$(BIN_DIR)/golangci-lint run
    26
    27golangci-lint: | $(BIN_DIR)
    28	@{ \
    29		set -e; \
    30		GOLANGCI_LINT_TMP_DIR=$$(mktemp -d); \
    31		cd $$GOLANGCI_LINT_TMP_DIR; \
    32		go mod init tmp; \
    33		GOBIN=$(BIN_DIR) go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.48.0; \
    34		rm -rf $$GOLANGCI_LINT_TMP_DIR; \
    35	}
    36
    37.PHONY: generate
    38generate:
    39	go generate ./internal/...

View as plain text