File tree 2 files changed +14
-7
lines changed
2 files changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -66,7 +66,6 @@ func main() {
66
66
stream := GetMockStream ()
67
67
68
68
// use a chan for producer to add tweet to it and consumer to consume from
69
-
70
69
tweetChan := make (chan * Tweet )
71
70
72
71
// Producer
Original file line number Diff line number Diff line change @@ -12,20 +12,28 @@ import (
12
12
"time"
13
13
)
14
14
15
- // GetMockStream is a blackbox function which returns a mock stream for
16
- // demonstration purposes
17
- func GetMockStream () Stream {
18
- return Stream {0 , mockdata }
15
+ // ErrEOF returns on End of File error
16
+ var ErrEOF = errors .New ("End of File" )
17
+
18
+ type Streaming interface {
19
+ Next () (* Tweet , error )
19
20
}
20
21
22
+ var _ Streaming = (* Stream )(nil )
23
+
24
+
21
25
// Stream is a mock stream for demonstration purposes, not threadsafe
22
26
type Stream struct {
23
27
pos int
24
28
tweets []Tweet
25
29
}
26
30
27
- // ErrEOF returns on End of File error
28
- var ErrEOF = errors .New ("End of File" )
31
+ // GetMockStream is a blackbox function which returns a mock stream for
32
+ // demonstration purposes
33
+ func GetMockStream () Stream {
34
+ return Stream {0 , mockdata }
35
+ }
36
+
29
37
30
38
// Next returns the next Tweet in the stream, returns EOF error if
31
39
// there are no more tweets
You can’t perform that action at this time.
0 commit comments