v1.4.0: generic Stream[T] — typed stream messages, drop (T, *Stream, error)
- Stream[T]: Send(v T) type-safe; message type recovered from the instantiated Send signature (reflect has no type-args API) - method signatures reduced to (error), (T, error), (*Stream[T], error); the (T, *Stream, error) first-message form is gone — send it via Send - return T and stream message T now run checkType at bind time (Stream[any] remains the explicit untyped escape hatch) - generated clients: TS onMessage: (data: T); Go <-chan T - fix vacuous panic assertions (fmt.Sprint(nil) -> "<nil>") in hardening/route test catch helpers Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
@@ -11,7 +11,7 @@ import (
|
||||
//
|
||||
// business OnClose -> wait ready -> invoke wait business return -> never Inject.
|
||||
func TestStreamOnCloseBeforeInjectDoesNotBlock(t *testing.T) {
|
||||
st := &Stream{}
|
||||
st := &Stream[any]{}
|
||||
registered := make(chan struct{})
|
||||
var called atomic.Int32
|
||||
go func() {
|
||||
@@ -35,7 +35,7 @@ func TestStreamOnCloseBeforeInjectDoesNotBlock(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestStreamOnCloseAfterAlreadyClosedRunsImmediately(t *testing.T) {
|
||||
st := &Stream{}
|
||||
st := &Stream[any]{}
|
||||
st.Inject(make(chan any), make(chan struct{}))
|
||||
st.Close()
|
||||
var called atomic.Int32
|
||||
|
||||
Reference in New Issue
Block a user