// Package requestid provides a shared context key for request IDs, // allowing both client and server packages to access request IDs // without circular imports. package requestid import "context" type key struct{} // NewContext returns a context with the given request ID. func NewContext(ctx context.Context, id string) context.Context { return context.WithValue(ctx, key{}, id) } // FromContext returns the request ID from ctx, or empty string if not set. func FromContext(ctx context.Context) string { id, _ := ctx.Value(key{}).(string) return id }