Skip to content

Commit a1a6c16

Browse files
Fixed the range logic for passing in feed pointers
1 parent 9f451d9 commit a1a6c16

1 file changed

Lines changed: 3 additions & 7 deletions

File tree

‎chapter2/sample/search/search.go‎

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,11 @@ func Run(searchTerm string) {
4242
matcher = matchers["default"]
4343
}
4444

45-
// Make a copy of the value to give each goroutine
46-
// their own copy.
47-
find := feed
48-
4945
// Launch the goroutine to perform the search.
50-
go func() {
51-
Match(matcher, find, searchTerm, results)
46+
go func(feed *Feed) {
47+
Match(matcher, feed, searchTerm, results)
5248
waitGroup.Done()
53-
}()
49+
}(feed)
5450
}
5551

5652
// Launch a groutine to monitor when all the work is done.

0 commit comments

Comments
 (0)