In this section, we will develop a handy command-line utility that reads a number of web pages, which can be found in a text file or read from standard input, and returns the number of times a given keyword was found in these web pages. In order to be faster, the utility will use goroutines to get the desired data and a monitoring process to gather the data and present it on the screen. The name of the utility will be findKeyword.go and will be presented in five parts.
The first part of the utility is the following:
package main import ( "bufio" "fmt" "net/http" "net/url" "os" "regexp" ) type Data struct { URL string Keyword string Times int Error error }
The Data struct type will be used for passing information between channels.
The...