mocktracer/mocktracer.go
func New() *MockTracer {
	t := &MockTracer{
		finishedSpans: []*MockSpan{},
		injectors:     make(map[interface{}]Injector),
		extractors:    make(map[interface{}]Extractor),
	}

	// register default injectors/extractors
	textPropagator := new(TextMapPropagator)
	t.RegisterInjector(opentracing.TextMap, textPropagator)
	t.RegisterExtractor(opentracing.TextMap, textPropagator)

	httpPropagator := &TextMapPropagator{HTTPHeaders: true}
	t.RegisterInjector(opentracing.HTTPHeaders, httpPropagator)
	t.RegisterExtractor(opentracing.HTTPHeaders, httpPropagator)

	return t
}
func New() *MockTracer {
	t := &MockTracer{
		finishedSpans: []*MockSpan{},
		injectors:     make(map[interface{}]Injector),
		extractors:    make(map[interface{}]Extractor),
	}

	// register default injectors/extractors
	textPropagator := new(TextMapPropagator)
	t.RegisterInjector(opentracing.TextMap, textPropagator)
	t.RegisterExtractor(opentracing.TextMap, textPropagator)

	httpPropagator := &TextMapPropagator{HTTPHeaders: true}
	t.RegisterInjector(opentracing.HTTPHeaders, httpPropagator)
	t.RegisterExtractor(opentracing.HTTPHeaders, httpPropagator)

	return t
}
func New ( ) * MockTracer { t := & MockTracer { finishedSpans : [ ] * MockSpan { } , injectors : make ( map [ interface { } ] Injector ) , extractors : make ( map [ interface { } ] Extractor ) , } // register default injectors/extractors textPropagator := new ( TextMapPropagator ) t . RegisterInjector ( opentracing . TextMap , textPropagator ) t . RegisterExtractor ( opentracing . TextMap , textPropagator ) httpPropagator := & TextMapPropagator { HTTPHeaders : true } t . RegisterInjector ( opentracing . HTTPHeaders , httpPropagator ) t . RegisterExtractor ( opentracing . HTTPHeaders , httpPropagator ) return t }
// New returns a MockTracer opentracing.Tracer implementation that's intended
// to facilitate tests of OpenTracing instrumentation.
New returns a MockTracer opentracing . Tracer implementation that s intended to facilitate tests of OpenTracing instrumentation .