代码拉取完成,页面将自动刷新
SHELL := /bin/bash -o pipefail
UNAME_OS := $(shell uname -s)
UNAME_ARCH := $(shell uname -m)
TMP_BASE := .tmp
TMP := $(TMP_BASE)/$(UNAME_OS)/$(UNAME_ARCH)
TMP_BIN = $(TMP)/bin
GOLINT_VERSION := 8f45f776aaf18cebc8d65861cc70c33c60471952
GOLINT := $(TMP_BIN)/golint
$(GOLINT):
$(eval GOLINT_TMP := $(shell mktemp -d))
@cd $(GOLINT_TMP); go get github.com/golang/lint/golint@$(GOLINT_VERSION)
@rm -rf $(GOLINT_TMP)
ERRCHECK_VERSION := v1.2.0
ERRCHECK := $(TMP_BIN)/errcheck
$(ERRCHECK):
$(eval ERRCHECK_TMP := $(shell mktemp -d))
@cd $(ERRCHECK_TMP); go get github.com/kisielk/errcheck@$(ERRCHECK_VERSION)
@rm -rf $(ERRCHECK_TMP)
STATICCHECK_VERSION := c2f93a96b099cbbec1de36336ab049ffa620e6d7
STATICCHECK := $(TMP_BIN)/staticcheck
$(STATICCHECK):
$(eval STATICCHECK_TMP := $(shell mktemp -d))
@cd $(STATICCHECK_TMP); go get honnef.co/go/tools/cmd/staticcheck@$(STATICCHECK_VERSION)
@rm -rf $(STATICCHECK_TMP)
unexport GOPATH
export GO111MODULE := on
export GOBIN := $(abspath $(TMP_BIN))
export PATH := $(GOBIN):$(PATH)
.DEFAULT_GOAL := all
.PHONY: all
all: lint test
.PHONY: install
install:
go install ./...
.PHONY: golint
golint: $(GOLINT)
@# TODO: readd cmd/proto2gql when fixed
@#for file in $(shell find . -name '*.go'); do
for file in $(shell find . -name '*.go' | grep -v cmd/proto2gql); do \
golint $${file}; \
if [ -n "$$(golint $${file})" ]; then \
exit 1; \
fi; \
done
.PHONY: vet
vet:
go vet ./...
.PHONY: testdeps
errcheck: $(ERRCHECK)
errcheck ./...
.PHONY: staticcheck
staticcheck: $(STATICCHECK)
staticcheck -checks "all -U1000" ./...
.PHONY: lint
# TODO: readd errcheck when fixed
#lint: golint vet errcheck staticcheck
#lint: golint vet staticcheck
lint: golint vet
.PHONY: test
test:
go test -race -coverprofile=coverage.txt -covermode=atomic ./...
.PHONY: clean
clean:
go clean -i ./...
.PHONY: integration
integration:
PB=y go test -cover
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。