request_id.go
func GetRequestID(ctx context.Context) (string, error) {
	if ctx == nil {
		return "", errors.New("nil context")
	}

	reqID, ok := ctx.Value(contextRequestID).(string)
	if !ok {
		return "", errors.New("unexpected type")
	}

	if len(reqID) == 0 {
		return "", errors.New("empty value in context")
	}

	return reqID, nil
}
func GetRequestID(ctx context.Context) (string, error) {
	if ctx == nil {
		return "", errors.New("nil context")
	}

	reqID, ok := ctx.Value(contextRequestID).(string)
	if !ok {
		return "", errors.New("unexpected type")
	}

	if len(reqID) == 0 {
		return "", errors.New("empty value in context")
	}

	return reqID, nil
}
// GetRequestID returns a request ID from the given context if one is present.
// Returns the empty string if a request ID cannot be found.