The functionality of the context package will be illustrated much better and in greater depth by using the Go code of the useContext.go program, which is presented in five parts. In this example, you will create an HTTP client that does not want to wait too long for the response of the HTTP server, which is not an unusual scenario. In fact, as almost all HTTP clients support such functionality, you will study another technique for timing out an HTTP request in Chapter 12, The Foundations of Network Programming in Go.
The useContext.go program requires two command-line arguments: the URL of the server to which it is going to connect and the time for which the presented utility should wait. If the ...