File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -70,7 +70,7 @@ func init() {
7070func (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 )
@@ -113,12 +113,12 @@ func (m rssMatcher) Search(feed *search.Feed, searchTerm string) ([]*search.Resu
113113
114114// retrieve performs a HTTP Get request for the rss feed and decodes the results.
115115func (m rssMatcher ) retrieve (feed * search.Feed ) (* rssDocument , error ) {
116- if feed .Uri == "" {
116+ if feed .URI == "" {
117117 return nil , errors .New ("No rss feed uri provided" )
118118 }
119119
120120 // Retrieve the rss feed document from the web.
121- resp , err := http .Get (feed .Uri )
121+ resp , err := http .Get (feed .URI )
122122 if err != nil {
123123 return nil , err
124124 }
Original file line number Diff line number Diff line change @@ -10,12 +10,12 @@ const dataFile = "data/data.json"
1010// Feed contains information we need to process a feed.
1111type Feed struct {
1212 Name string `json:"site"`
13- Uri string `json:"link"`
13+ URI string `json:"link"`
1414 Type string `json:"type"`
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.
Original file line number Diff line number Diff line change 66)
77
88// A map of registered matchers for searching.
9- var matchers map [ string ] Matcher = make (map [string ]Matcher )
9+ var matchers = make (map [string ]Matcher )
1010
1111// Run performs the search logic.
1212func Run (searchTerm string ) {
@@ -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 }
You can’t perform that action at this time.
0 commit comments