summaryrefslogtreecommitdiffstats
path: root/vendor/go.uber.org/zap/Makefile
diff options
context:
space:
mode:
authorWim <wim@42.be>2020-08-10 00:29:54 +0200
committerGitHub <noreply@github.com>2020-08-10 00:29:54 +0200
commit4e50fd864921c556988c919269448efdb90fa961 (patch)
treea3625f03f8de3c4f3841364000a4ea3aa42c1533 /vendor/go.uber.org/zap/Makefile
parentdfdffa0027334e55ce213fc6eb62206dbf48baf6 (diff)
downloadmatterbridge-msglm-4e50fd864921c556988c919269448efdb90fa961.tar.gz
matterbridge-msglm-4e50fd864921c556988c919269448efdb90fa961.tar.bz2
matterbridge-msglm-4e50fd864921c556988c919269448efdb90fa961.zip
Use mattermost v5 module (#1192)
Diffstat (limited to 'vendor/go.uber.org/zap/Makefile')
-rw-r--r--vendor/go.uber.org/zap/Makefile77
1 files changed, 32 insertions, 45 deletions
diff --git a/vendor/go.uber.org/zap/Makefile b/vendor/go.uber.org/zap/Makefile
index 073e9aa9..dfaf6406 100644
--- a/vendor/go.uber.org/zap/Makefile
+++ b/vendor/go.uber.org/zap/Makefile
@@ -1,74 +1,61 @@
-export GO15VENDOREXPERIMENT=1
+export GOBIN ?= $(shell pwd)/bin
+GOLINT = $(GOBIN)/golint
+STATICCHECK = $(GOBIN)/staticcheck
BENCH_FLAGS ?= -cpuprofile=cpu.pprof -memprofile=mem.pprof -benchmem
-PKGS ?= $(shell glide novendor)
-# Many Go tools take file globs or directories as arguments instead of packages.
-PKG_FILES ?= *.go zapcore benchmarks buffer zapgrpc zaptest zaptest/observer internal/bufferpool internal/exit internal/color internal/ztest
-# The linting tools evolve with each Go version, so run them only on the latest
-# stable release.
-GO_VERSION := $(shell go version | cut -d " " -f 3)
-GO_MINOR_VERSION := $(word 2,$(subst ., ,$(GO_VERSION)))
-LINTABLE_MINOR_VERSIONS := 12
-ifneq ($(filter $(LINTABLE_MINOR_VERSIONS),$(GO_MINOR_VERSION)),)
-SHOULD_LINT := true
-endif
+# Directories containing independent Go modules.
+#
+# We track coverage only for the main module.
+MODULE_DIRS = . ./benchmarks
+# Many Go tools take file globs or directories as arguments instead of packages.
+GO_FILES := $(shell \
+ find . '(' -path '*/.*' -o -path './vendor' ')' -prune \
+ -o -name '*.go' -print | cut -b3-)
.PHONY: all
all: lint test
-.PHONY: dependencies
-dependencies:
- @echo "Installing Glide and locked dependencies..."
- glide --version || go get -u -f github.com/Masterminds/glide
- glide install
- @echo "Installing test dependencies..."
- go install ./vendor/github.com/axw/gocov/gocov
- go install ./vendor/github.com/mattn/goveralls
-ifdef SHOULD_LINT
- @echo "Installing golint..."
- go install ./vendor/github.com/golang/lint/golint
-else
- @echo "Not installing golint, since we don't expect to lint on" $(GO_VERSION)
-endif
-
-# Disable printf-like invocation checking due to testify.assert.Error()
-VET_RULES := -printf=false
-
.PHONY: lint
-lint:
-ifdef SHOULD_LINT
+lint: $(GOLINT) $(STATICCHECK)
@rm -rf lint.log
@echo "Checking formatting..."
- @gofmt -d -s $(PKG_FILES) 2>&1 | tee lint.log
- @echo "Installing test dependencies for vet..."
- @go test -i $(PKGS)
+ @gofmt -d -s $(GO_FILES) 2>&1 | tee lint.log
@echo "Checking vet..."
- @go vet $(VET_RULES) $(PKGS) 2>&1 | tee -a lint.log
+ @$(foreach dir,$(MODULE_DIRS),(cd $(dir) && go vet ./... 2>&1) &&) true | tee -a lint.log
@echo "Checking lint..."
- @$(foreach dir,$(PKGS),golint $(dir) 2>&1 | tee -a lint.log;)
+ @$(foreach dir,$(MODULE_DIRS),(cd $(dir) && $(GOLINT) ./... 2>&1) &&) true | tee -a lint.log
+ @echo "Checking staticcheck..."
+ @$(foreach dir,$(MODULE_DIRS),(cd $(dir) && $(STATICCHECK) ./... 2>&1) &&) true | tee -a lint.log
@echo "Checking for unresolved FIXMEs..."
- @git grep -i fixme | grep -v -e vendor -e Makefile | tee -a lint.log
+ @git grep -i fixme | grep -v -e Makefile | tee -a lint.log
@echo "Checking for license headers..."
- @./check_license.sh | tee -a lint.log
+ @./checklicense.sh | tee -a lint.log
@[ ! -s lint.log ]
-else
- @echo "Skipping linters on" $(GO_VERSION)
-endif
+
+$(GOLINT):
+ go install golang.org/x/lint/golint
+
+$(STATICCHECK):
+ go install honnef.co/go/tools/cmd/staticcheck
.PHONY: test
test:
- go test -race $(PKGS)
+ @$(foreach dir,$(MODULE_DIRS),(cd $(dir) && go test -race ./...) &&) true
.PHONY: cover
cover:
- ./scripts/cover.sh $(PKGS)
+ go test -race -coverprofile=cover.out -coverpkg=./... ./...
+ go tool cover -html=cover.out -o cover.html
.PHONY: bench
BENCH ?= .
bench:
- @$(foreach pkg,$(PKGS),go test -bench=$(BENCH) -run="^$$" $(BENCH_FLAGS) $(pkg);)
+ @$(foreach dir,$(MODULE_DIRS), ( \
+ cd $(dir) && \
+ go list ./... | xargs -n1 go test -bench=$(BENCH) -run="^$$" $(BENCH_FLAGS) \
+ ) &&) true
.PHONY: updatereadme
updatereadme: