From 2dbe731f5a248cae260ff4c007016f7afbbce54f Mon Sep 17 00:00:00 2001 From: wurui Date: Thu, 18 Aug 2022 17:10:26 +0800 Subject: [PATCH] fix(source): source Write return 0 if error --- source.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source.go b/source.go index 4883588a0..6348d3887 100644 --- a/source.go +++ b/source.go @@ -54,7 +54,11 @@ func NewSource(name string, opts ...Option) Source { // Write the data to downstream. func (s *yomoSource) Write(data []byte) (int, error) { - return len(data), s.WriteWithTag(s.tag, data) + err := s.WriteWithTag(s.tag, data) + if err != nil { + return 0, err + } + return len(data), nil } // SetDataTag will set the tag of data when invoking Write().