package pipeline type RunToken struct { Result any Err error doneChan chan any } func NewRunToken() *RunToken { return &RunToken{ Result: nil, Err: nil, doneChan: make(chan any), } } func (token *RunToken) Wait() { if token.doneChan == nil { return } for { select { case <-token.doneChan: return } } } func (token *RunToken) Done() { if token.doneChan == nil { return } close(token.doneChan) token.doneChan = nil }