November 2017
Intermediate to advanced
670 pages
17h 35m
English
The DEBUG output leads us to our last go source file, namely requestor.go:
package decoratorimport ( "io" "io/ioutil" "net/http" "os" "os/signal" "sync" "syscall" "time")type response struct { duration time.Duration err error}
The response struct is used to record the duration and any error from running our request. When we capitalize names of symbols, for example, the "J" in our struct named Job in the following code, we are telling Go to export it. When we import a package we will only be able to access exported symbols.
type Job struct { Client Client NumRequests int Request *http.Request IntervalSecs int responseChan chan *response}
The private field, responses, is a channel of response pointers with a ...