mocktracer/propagation.go
func (t *TextMapPropagator) Inject(spanContext MockSpanContext, carrier interface{}) error {
	writer, ok := carrier.(opentracing.TextMapWriter)
	if !ok {
		return opentracing.ErrInvalidCarrier
	}
	// Ids:
	writer.Set(mockTextMapIdsPrefix+"traceid", strconv.Itoa(spanContext.TraceID))
	writer.Set(mockTextMapIdsPrefix+"spanid", strconv.Itoa(spanContext.SpanID))
	writer.Set(mockTextMapIdsPrefix+"sampled", fmt.Sprint(spanContext.Sampled))
	// Baggage:
	for baggageKey, baggageVal := range spanContext.Baggage {
		safeVal := baggageVal
		if t.HTTPHeaders {
			safeVal = url.QueryEscape(baggageVal)
		}
		writer.Set(mockTextMapBaggagePrefix+baggageKey, safeVal)
	}
	return nil
}
func (t *TextMapPropagator) Inject(spanContext MockSpanContext, carrier interface{}) error {
	writer, ok := carrier.(opentracing.TextMapWriter)
	if !ok {
		return opentracing.ErrInvalidCarrier
	}
	// Ids:
	writer.Set(mockTextMapIdsPrefix+"traceid", strconv.Itoa(spanContext.TraceID))
	writer.Set(mockTextMapIdsPrefix+"spanid", strconv.Itoa(spanContext.SpanID))
	writer.Set(mockTextMapIdsPrefix+"sampled", fmt.Sprint(spanContext.Sampled))
	// Baggage:
	for baggageKey, baggageVal := range spanContext.Baggage {
		safeVal := baggageVal
		if t.HTTPHeaders {
			safeVal = url.QueryEscape(baggageVal)
		}
		writer.Set(mockTextMapBaggagePrefix+baggageKey, safeVal)
	}
	return nil
}
// Inject implements the Injector interface