Skip to content

Commit 48efe2c

Browse files
Fixed comments.
1 parent 03edbba commit 48efe2c

6 files changed

Lines changed: 11 additions & 9 deletions

File tree

‎chapter2/sample/main.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ import (
77

88
// main is the entry point for the program.
99
func main() {
10-
// Perform the search.
10+
// Perform the search for the specified term.
1111
search.Run("president")
1212
}

‎chapter2/sample/matchers/rss.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ type (
5656
// rssMatcher implements the Matcher interface.
5757
type rssMatcher struct{}
5858

59-
// init registered the matcher with the program
59+
// init registeres the matcher with the program.
6060
func init() {
6161
search.Register("rss", &rssMatcher{})
6262
}

‎chapter2/sample/search/default.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package search
33
// defaultMatcher implements the defaut matcher.
44
type defaultMatcher struct{}
55

6-
// init registered the matcher with the program
6+
// init registeres the default matcher with the program.
77
func init() {
88
Register("default", &defaultMatcher{})
99
}

‎chapter2/sample/search/feed.go‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ type Feed struct {
1616
Type string `json:"type"`
1717
}
1818

19-
// RetrieveFeed reads and unmarshals the feed data file
20-
// into a native slice for use.
19+
// RetrieveFeed reads and unmarshals the feed data file.
2120
func RetrieveFeed() ([]*Feed, error) {
2221
// Open the file.
2322
file, err := os.Open(dataFile)
@@ -29,9 +28,11 @@ func RetrieveFeed() ([]*Feed, error) {
2928
// the function returns.
3029
defer file.Close()
3130

32-
// Decode the file into a slice of feed values.
33-
// We don't need to check for errors, the caller can do this.
31+
// Decode the file into a slice of pointers
32+
// to Feed values.
3433
var feeds []*Feed
3534
err = json.NewDecoder(file).Decode(&feeds)
35+
36+
// We don't need to check for errors, the caller can do this.
3637
return feeds, err
3738
}

‎chapter2/sample/search/match.go‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ type Result struct {
1111
Content string
1212
}
1313

14-
// Matcher defines the behavior required by the Search function.
14+
// Matcher defines the behavior required by types that want
15+
// to implement a new search type.
1516
type Matcher interface {
1617
Search(feed *Feed, searchTerm string) ([]*Result, error)
1718
}

‎chapter2/sample/search/search.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ var (
99
// Used to synchronize access to the matchers map.
1010
lock sync.Mutex
1111

12-
// A map of registered matchers for searching
12+
// A map of registered matchers for searching.
1313
matchers map[string]Matcher = make(map[string]Matcher)
1414
)
1515

0 commit comments

Comments
 (0)