Skip to content

Commit 53e02ee

Browse files
author
gbbr
committed
Renamed to shorter things
1 parent b9bfab3 commit 53e02ee

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

‎chapter7/patterns/search/searchers.go‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,51 +20,51 @@ type google struct{}
2020

2121
// Search implements the Searcher interface. It performs a search
2222
// against Google.
23-
func (g google) Search(term string, resChan chan<- []Result) {
23+
func (g google) Search(term string, results chan<- []Result) {
2424
log.Printf("Google : Search : Started : search term[%s]\n", term)
2525

2626
// Slice for the results.
27-
var results []Result
27+
var r []Result
2828

2929
// Simulate an amount of time for the search.
3030
time.Sleep(time.Millisecond * time.Duration(rand.Int63n(900)))
3131

3232
// Simulate a result for the search.
33-
results = append(results, Result{
33+
r = append(r, Result{
3434
Engine: "Google",
3535
Title: "The Go Programming Language",
3636
Description: "The Go Programming Language",
3737
Link: "https://golang.org/",
3838
})
3939

40-
log.Printf("Google : Search : Completed : Found[%d]\n", len(results))
41-
resChan <- results
40+
log.Printf("Google : Search : Completed : Found[%d]\n", len(r))
41+
results <- r
4242
}
4343

4444
// Bing provides support for Bing searches.
4545
type bing struct{}
4646

4747
// Search implements the Searcher interface. It performs a search
4848
// against Bing.
49-
func (b bing) Search(term string, resChan chan<- []Result) {
49+
func (b bing) Search(term string, results chan<- []Result) {
5050
log.Printf("Bing : Search : Started : search term [%s]\n", term)
5151

5252
// Slice for the results.
53-
var results []Result
53+
var r []Result
5454

5555
// Simulate an amount of time for the search.
5656
time.Sleep(time.Millisecond * time.Duration(rand.Int63n(900)))
5757

5858
// Simulate a result for the search.
59-
results = append(results, Result{
59+
r = append(r, Result{
6060
Engine: "Bing",
6161
Title: "A Tour of Go",
6262
Description: "Welcome to a tour of the Go programming language.",
6363
Link: "http://tour.golang.org/",
6464
})
6565

66-
log.Printf("Bing : Search : Completed : Found[%d]\n", len(results))
67-
resChan <- results
66+
log.Printf("Bing : Search : Completed : Found[%d]\n", len(r))
67+
results <- r
6868
}
6969

7070
// Yahoo provides support for Yahoo searches.

0 commit comments

Comments
 (0)