-
Notifications
You must be signed in to change notification settings - Fork 342
Open
Labels
bug reportReported bug.Reported bug.
Description
Describe the bug
When called with a slice, JustItem
returns a Single
that sends multiple values. However the documentation (and the name) suggests that a Single
should send one value. There appears to be no way to send a slice as a single value, which is very counterintuitive!
To Reproduce
The following code demsonstrates the issue: (also on Go playground)
package main
import (
"fmt"
"github.com/reactivex/rxgo/v2"
)
func main() {
data := []int{1, 2, 3}
observable := rxgo.JustItem(data)
for x := range observable.Observe() {
fmt.Println("Item:", x.V)
}
}
Produces output:
Item: 1
Item: 2
Item: 3
Expected behavior
Output:
Item: [1 2 3]
Additional context
The problem appears to be caused by the send
function (item.go:75) which switches on the type of each item.
Metadata
Metadata
Assignees
Labels
bug reportReported bug.Reported bug.