diff --git a/tracing/context.go b/tracing/context.go index c1397d0..38441b3 100644 --- a/tracing/context.go +++ b/tracing/context.go @@ -14,7 +14,7 @@ const ( KeyOffset KafkaContextKey = "kafka.offset" ) -// MessageToContext returns new context with topic, partition and offset values from msg. +// MessageToContext returns new [context.Context] with topic, partition and offset values from msg. func MessageToContext(ctx context.Context, msg *kafka.Message) context.Context { ctx = context.WithValue(ctx, KeyTopic, msg.Topic) ctx = context.WithValue(ctx, KeyPartition, msg.Partition) @@ -23,7 +23,7 @@ func MessageToContext(ctx context.Context, msg *kafka.Message) context.Context { return ctx } -// ContextToTags returns new map of tags from ctx. +// ContextToTags returns new map of tags from the [context.Context]. func ContextToTags(ctx context.Context) map[string]interface{} { tags := make(map[string]interface{}) diff --git a/tracing/opentracing/propagation.go b/tracing/opentracing/propagation.go index af3b737..98447d5 100644 --- a/tracing/opentracing/propagation.go +++ b/tracing/opentracing/propagation.go @@ -79,7 +79,7 @@ func ContextToKafka(tracer opentracing.Tracer, logger log.Logger) transport.Requ // KafkaToContext returns an [transport.RequestFunc] that tries to join with an // OpenTracing trace found in msg and starts a new Span called // operationName accordingly. If no trace could be found in msg, the Span -// will be a trace root. The Span is incorporated in the returned Context and +// will be a trace root. The Span is incorporated in the returned [context.Context] and // can be retrieved with opentracing.SpanFromContext(ctx). func KafkaToContext(tracer opentracing.Tracer, operationName string, logger log.Logger) transport.RequestFunc { return func(ctx context.Context, msg *kafka.Message) context.Context { diff --git a/transport/consumer.go b/transport/consumer.go index 01e5f35..c82a0d2 100644 --- a/transport/consumer.go +++ b/transport/consumer.go @@ -8,7 +8,7 @@ import ( "github.com/go-kit/kit/transport" ) -// Consumer wraps an endpoint and implements [kafka.Handler]. +// Consumer wraps an [endpoint.Endpoint] and implements [kafka.Handler]. type Consumer struct { e endpoint.Endpoint dec DecodeRequestFunc @@ -18,7 +18,7 @@ type Consumer struct { errorHandler transport.ErrorHandler } -// NewConsumer constructs a new consumer, which implements kafka.Handler and wraps the provided endpoint. +// NewConsumer constructs a new consumer, which implements [kafka.Handler] and wraps the provided [endpoint.Endpoint]. func NewConsumer( e endpoint.Endpoint, dec DecodeRequestFunc, diff --git a/transport/producer.go b/transport/producer.go index bbdf5d4..5e0b7aa 100644 --- a/transport/producer.go +++ b/transport/producer.go @@ -9,7 +9,7 @@ import ( ) // Producer wraps single Kafka topic for message producing -// and implements endpoint.Endpoint. +// and implements [endpoint.Endpoint]. type Producer struct { handler kafka.Handler topic string @@ -50,7 +50,7 @@ func ProducerResponse(response interface{}) ProducerOption { } } -// ProducerBefore sets the RequestFuncs that are applied to the outgoing producer +// ProducerBefore sets the [RequestFunc]s that are applied to the outgoing producer // request before it's invoked. func ProducerBefore(before ...RequestFunc) ProducerOption { return func(p *Producer) { @@ -58,7 +58,7 @@ func ProducerBefore(before ...RequestFunc) ProducerOption { } } -// ProducerAfter adds one or more ProducerResponseFuncs, which are applied to the +// ProducerAfter adds one or more [ProducerResponseFunc]s, which are applied to the // context after successful message producing. // This is useful for context-manipulation operations. func ProducerAfter(after ...ProducerResponseFunc) ProducerOption { @@ -67,7 +67,7 @@ func ProducerAfter(after ...ProducerResponseFunc) ProducerOption { } } -// ProducerFinalizer adds one or more ProducerFinalizerFuncs to be executed at the +// ProducerFinalizer adds one or more [ProducerFinalizerFunc]s to be executed at the // end of producing Kafka message. Finalizers are executed in the order in which they // were added. By default, no finalizer is registered. func ProducerFinalizer(f ...ProducerFinalizerFunc) ProducerOption { @@ -118,7 +118,7 @@ func (p Producer) Endpoint() endpoint.Endpoint { type ProducerFinalizerFunc func(ctx context.Context, err error) // EncodeJSONRequest is an [EncodeRequestFunc] that serializes the request as a -// JSON object to the Message value. +// JSON object to the [Message] value. // Many services can use it as a sensible default. func EncodeJSONRequest(_ context.Context, msg *kafka.Message, request interface{}) error { rawJSON, err := json.Marshal(request)