Skip to content

Commit

Permalink
bug return reflect value
Browse files Browse the repository at this point in the history
  • Loading branch information
verzth committed May 14, 2021
1 parent 42c90d5 commit fd84357
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions utils/slice.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ func (s slice) First(collections interface{}) (col interface{}) {
}

if el.Len() > 0 {
return el.Index(0)
return el.Index(0).Interface()
}
}
return
Expand All @@ -261,7 +261,7 @@ func (s slice) Last(collections interface{}) (col interface{}) {
}

if el.Len() > 0 {
return el.Index(el.Len()-1)
return el.Index(el.Len()-1).Interface()
}
}
return
Expand All @@ -285,7 +285,7 @@ func (s slice) FirstWhere(collections interface{}, fn func(int) bool) (col inter

for i:=0; i<el.Len(); i++{
if fn(i) {
return el.Index(i)
return el.Index(i).Interface()
}
}
}
Expand All @@ -310,7 +310,7 @@ func (s slice) LastWhere(collections interface{}, fn func(int) bool) (col interf

for i:=0; i<el.Len(); i++{
if fn(i) {
col = el.Index(i)
col = el.Index(i).Interface()
}
}
}
Expand Down

0 comments on commit fd84357

Please sign in to comment.