.PHONY: plandb
plandb:
@go build -o plandb cmd/main/main.go
.PHONY: tester
tester:
@go build -o tester cmd/tester/main.go
.PHONY: config
config:
$(info [go tidy])
@go mod tidy
############# code clean
.PHONY: fmt
fmt:
gofmt -l -s -w .
.PHONY: install-static-check-tools
install-static-check-tools:
@curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | bash -s -- -b $(GOPATH)/bin v1.61.0
@go install github.com/matrixorigin/linter/cmd/molint@latest
@go install github.com/apache/skywalking-eyes/cmd/[email protected]
.PHONY: static-check
static-check: config err-check
#$(CGO_OPTS) go vet -vettool=`which molint` ./...
$(CGO_OPTS) license-eye -c .licenserc.yml header check
$(CGO_OPTS) license-eye -c .licenserc.yml dep check
$(CGO_OPTS) golangci-lint run -c .golangci.yml ./...
fmtErrs := $(shell grep -onr 'fmt.Errorf' pkg/ --exclude-dir=.git --exclude-dir=vendor \
--exclude=*.pb.go --exclude=system_vars.go --exclude=Makefile)
errNews := $(shell grep -onr 'errors.New' pkg/ --exclude-dir=.git --exclude-dir=vendor \
--exclude=*.pb.go --exclude=system_vars.go --exclude=Makefile)
.PHONY: err-check
err-check:
#ifneq ("$(strip $(fmtErrs))$(strip $(errNews))", "")
# ifneq ("$(strip $(fmtErrs))", "")
# $(warning 'fmt.Errorf()' is found.)
# $(warning One of 'fmt.Errorf()' is called at: $(shell printf "%s\n" $(fmtErrs) | head -1))
# endif
# ifneq ("$(strip $(errNews))", "")
# $(warning 'errors.New()' is found.)
# $(warning One of 'errors.New()' is called at: $(shell printf "%s\n" $(errNews) | head -1))
# endif
#
# $(error Use xxxerr instead.)
#else
# $(info Neither 'fmt.Errorf()' nor 'errors.New()' is found)
#endif