Skip to content

Commit 710b8b7

Browse files
golint compliant and idiomatic.
1 parent d185ae4 commit 710b8b7

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

‎chapter2/sample/matchers/rss.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ func init() {
7070
func (m rssMatcher) Search(feed *search.Feed, searchTerm string) ([]*search.Result, error) {
7171
var results []*search.Result
7272

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

7575
// Retrieve the data to search.
7676
document, err := m.retrieve(feed)

‎chapter2/sample/search/feed.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ type Feed struct {
1515
}
1616

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

2929
// Decode the file into a slice of pointers
3030
// to Feed values.
31-
var feeds []Feed
31+
var feeds []*Feed
3232
err = json.NewDecoder(file).Decode(&feeds)
3333

3434
// We don't need to check for errors, the caller can do this.

‎chapter2/sample/search/search.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ func Run(searchTerm string) {
3535
}
3636

3737
// Launch the goroutine to perform the search.
38-
go func(matcher Matcher, feed Feed) {
39-
Match(matcher, &feed, searchTerm, results)
38+
go func(matcher Matcher, feed *Feed) {
39+
Match(matcher, feed, searchTerm, results)
4040
waitGroup.Done()
4141
}(matcher, feed)
4242
}

0 commit comments

Comments
 (0)