Skip to content

Commit

Permalink
golint compliant and idiomatic.
Browse files Browse the repository at this point in the history
  • Loading branch information
ardan-bkennedy committed Jul 16, 2014
1 parent d185ae4 commit 710b8b7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion chapter2/sample/matchers/rss.go
Expand Up @@ -70,7 +70,7 @@ func init() {
func (m rssMatcher) Search(feed *search.Feed, searchTerm string) ([]*search.Result, error) {
var results []*search.Result

log.Printf("Search Feed Type[%s] Site[%s] For Uri[%s]\n", feed.Type, feed.Name, feed.URI)
log.Printf("Search Feed Type[%s] Site[%s] For URI[%s]\n", feed.Type, feed.Name, feed.URI)

// Retrieve the data to search.
document, err := m.retrieve(feed)
Expand Down
4 changes: 2 additions & 2 deletions chapter2/sample/search/feed.go
Expand Up @@ -15,7 +15,7 @@ type Feed struct {
}

// RetrieveFeeds reads and unmarshals the feed data file.
func RetrieveFeeds() ([]Feed, error) {
func RetrieveFeeds() ([]*Feed, error) {
// Open the file.
file, err := os.Open(dataFile)
if err != nil {
Expand All @@ -28,7 +28,7 @@ func RetrieveFeeds() ([]Feed, error) {

// Decode the file into a slice of pointers
// to Feed values.
var feeds []Feed
var feeds []*Feed
err = json.NewDecoder(file).Decode(&feeds)

// We don't need to check for errors, the caller can do this.
Expand Down
4 changes: 2 additions & 2 deletions chapter2/sample/search/search.go
Expand Up @@ -35,8 +35,8 @@ func Run(searchTerm string) {
}

// Launch the goroutine to perform the search.
go func(matcher Matcher, feed Feed) {
Match(matcher, &feed, searchTerm, results)
go func(matcher Matcher, feed *Feed) {
Match(matcher, feed, searchTerm, results)
waitGroup.Done()
}(matcher, feed)
}
Expand Down

0 comments on commit 710b8b7

Please sign in to comment.