Skip to content

Commit 92f1785

Browse files
author
gbbr
committed
Removed constructors
1 parent b3286f7 commit 92f1785

2 files changed

Lines changed: 3 additions & 18 deletions

File tree

‎chapter7/patterns/search/search.go‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,17 @@ type searchSession struct {
2727

2828
func Google(s *searchSession) {
2929
log.Println("search : Submit : Info : Adding Google")
30-
s.searchers["google"] = NewGoogle()
30+
s.searchers["google"] = google{}
3131
}
3232

3333
func Bing(s *searchSession) {
3434
log.Println("search : Submit : Info : Adding Bing")
35-
s.searchers["bing"] = NewBing()
35+
s.searchers["bing"] = bing{}
3636
}
3737

3838
func Yahoo(s *searchSession) {
3939
log.Println("search : Submit : Info : Adding Yahoo")
40-
s.searchers["yahoo"] = NewYahoo()
40+
s.searchers["yahoo"] = yahoo{}
4141
}
4242

4343
func OnlyFirst(s *searchSession) { s.first = true }

‎chapter7/patterns/search/searchers.go‎

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@ func init() {
1818
// Google provides support for Google searches.
1919
type google struct{}
2020

21-
// NewGoogle returns a Google Searcher value.
22-
func NewGoogle() google {
23-
return google{}
24-
}
25-
2621
// Search implements the Searcher interface. It performs a search
2722
// against Google.
2823
func (g google) Search(searchTerm string, searchResults chan<- []Result) {
@@ -49,11 +44,6 @@ func (g google) Search(searchTerm string, searchResults chan<- []Result) {
4944
// Bing provides support for Bing searches.
5045
type bing struct{}
5146

52-
// NewBing returns a Bing Searcher value.
53-
func NewBing() bing {
54-
return bing{}
55-
}
56-
5747
// Search implements the Searcher interface. It performs a search
5848
// against Bing.
5949
func (b bing) Search(searchTerm string, searchResults chan<- []Result) {
@@ -80,11 +70,6 @@ func (b bing) Search(searchTerm string, searchResults chan<- []Result) {
8070
// Yahoo provides support for Yahoo searches.
8171
type yahoo struct{}
8272

83-
// NewYahoo returns a Yahoo Searcher value.
84-
func NewYahoo() yahoo {
85-
return yahoo{}
86-
}
87-
8873
// Search implements the Searcher interface. It performs a search
8974
// against Yahoo.
9075
func (y yahoo) Search(searchTerm string, searchResults chan<- []Result) {

0 commit comments

Comments
 (0)