Skip to content

Commit

Permalink
refactored to use a nil pointer for registering matchers
Browse files Browse the repository at this point in the history
  • Loading branch information
ardan-bkennedy committed May 24, 2014
1 parent a550d03 commit b08184c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion chapter2/sample/matchers/rss.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ type rssMatcher struct{}

// init registeres the matcher with the program.
func init() {
search.Register("rss", &rssMatcher{})
var matcher *rssMatcher
search.Register("rss", matcher)
}

// Search looks at the document for the specified search term.
Expand Down
3 changes: 2 additions & 1 deletion chapter2/sample/search/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ type defaultMatcher struct{}

// init registeres the default matcher with the program.
func init() {
Register("default", &defaultMatcher{})
var matcher *defaultMatcher
Register("default", matcher)
}

// Search implements the behavior for the default matcher.
Expand Down

0 comments on commit b08184c

Please sign in to comment.