@@ -56,7 +56,7 @@ func Finish(fns ...func() error) error {
56
56
return nil
57
57
}
58
58
59
- return MapReduceVoid [ func () error ] (func (source chan <- func () error ) {
59
+ return MapReduceVoid (func (source chan <- func () error ) {
60
60
for _ , fn := range fns {
61
61
source <- fn
62
62
}
@@ -101,8 +101,8 @@ func Map[T, U any](generate GenerateFunc[T], mapper MapFunc[T, U], opts ...Optio
101
101
// and reduces the output elements with given reducer.
102
102
func MapReduce [T , U , V any ](generate GenerateFunc [T ], mapper MapperFunc [T , U ], reducer ReducerFunc [U , V ],
103
103
opts ... Option ) (V , error ) {
104
- source := buildSource [ T ] (generate )
105
- return MapReduceWithSource [ T , U , V ] (source , mapper , reducer , opts ... )
104
+ source := buildSource (generate )
105
+ return MapReduceWithSource (source , mapper , reducer , opts ... )
106
106
}
107
107
108
108
// MapReduceWithSource maps all elements from source, and reduce the output elements with given reducer.
@@ -141,7 +141,7 @@ func MapReduceWithSource[T, U, V any](source <-chan T, mapper MapperFunc[T, U],
141
141
142
142
go func () {
143
143
defer func () {
144
- drain [ U ] (collector )
144
+ drain (collector )
145
145
146
146
if r := recover (); r != nil {
147
147
cancel (fmt .Errorf ("%v" , r ))
@@ -159,7 +159,7 @@ func MapReduceWithSource[T, U, V any](source <-chan T, mapper MapperFunc[T, U],
159
159
}, source , collector , done , options .workers )
160
160
161
161
value , ok := <- output
162
- if e := retErr .Load (); err != nil {
162
+ if e := retErr .Load (); e != nil {
163
163
err = e .(error )
164
164
} else if ok {
165
165
val = value
@@ -174,7 +174,7 @@ func MapReduceWithSource[T, U, V any](source <-chan T, mapper MapperFunc[T, U],
174
174
// and reduce the output elements with given reducer.
175
175
func MapReduceVoid [T , U any ](generate GenerateFunc [T ], mapper MapperFunc [T , U ],
176
176
reducer VoidReducerFunc [U ], opts ... Option ) error {
177
- _ , err := MapReduce [ T , U , interface {}] (generate , mapper , func (input <- chan U ,
177
+ _ , err := MapReduce (generate , mapper , func (input <- chan U ,
178
178
writer Writer [interface {}], cancel func (error )) {
179
179
reducer (input , cancel )
180
180
// We need to write a placeholder to let MapReduce to continue on reducer done,
0 commit comments