diff --git a/Makefile b/Makefile index 2a71a83b..bb7463cf 100644 --- a/Makefile +++ b/Makefile @@ -47,15 +47,30 @@ fmt: ./scripts/updateLicenses.sh .PHONY: lint -lint: +lint: vet golint lint-fmt lint-thrift-testing + +.PHONY: vet +vet: $(GOVET) $(PACKAGES) + +.PHONY: golint +golint: @cat /dev/null > $(LINT_LOG) @$(foreach pkg, $(PACKAGES), $(GOLINT) $(pkg) | grep -v crossdock/thrift >> $(LINT_LOG) || true;) @[ ! -s "$(LINT_LOG)" ] || (echo "Lint Failures" | cat - $(LINT_LOG) && false) + +.PHONY: lint-fmt +lint-fmt: @$(GOFMT) -e -s -l $(ALL_SRC) > $(FMT_LOG) ./scripts/updateLicenses.sh >> $(FMT_LOG) @[ ! -s "$(FMT_LOG)" ] || (echo "go fmt or license check failures, run 'make fmt'" | cat - $(FMT_LOG) && false) +# make sure thrift/ module does not import "testing" +.PHONY: lint-thrift-testing +lint-thrift-testing: + @cat /dev/null > $(LINT_LOG) + @(grep -rn '"testing"' thrift | grep -v README.md > $(LINT_LOG)) || true + @[ ! -s "$(LINT_LOG)" ] || (echo '"thrift" module must not import "testing", see issue #585' | cat - $(LINT_LOG) && false) .PHONY: install install: diff --git a/thrift/README.md b/thrift/README.md index 8798f75d..53857df9 100644 --- a/thrift/README.md +++ b/thrift/README.md @@ -4,6 +4,8 @@ This is a partial copy of Apache Thrift v0.14.1 (https://github.com/apache/thrif It is vendored code to avoid compatibility issues with Thrift versions. +The file logger.go is modified to remove dependency on "testing" (see Issuer #585). + See: * https://github.com/jaegertracing/jaeger-client-go/pull/584 * https://github.com/jaegertracing/jaeger-client-go/pull/303 diff --git a/thrift/logger.go b/thrift/logger.go index c42aac99..50d44ec8 100644 --- a/thrift/logger.go +++ b/thrift/logger.go @@ -22,7 +22,6 @@ package thrift import ( "log" "os" - "testing" ) // Logger is a simple wrapper of a logging function. @@ -52,15 +51,6 @@ func StdLogger(logger *log.Logger) Logger { } } -// TestLogger is a Logger implementation can be used in test codes. -// -// It fails the test when being called. -func TestLogger(tb testing.TB) Logger { - return func(msg string) { - tb.Errorf("logger called with msg: %q", msg) - } -} - func fallbackLogger(logger Logger) Logger { if logger == nil { return StdLogger(nil)