August 2019
Beginner to intermediate
798 pages
17h 2m
English
As the web client of the previous section is relatively simplistic and does not give you any flexibility, in this section, you will learn how to read a URL more elegantly without using the http.Get() function, and with more options. The name of the utility is advancedWebClient.go and it is going to be presented in five parts.
The first code segment of advancedWebClient.go contains the following Go code:
package main
import (
"fmt"
"net/http"
"net/http/httputil"
"net/url"
"os"
"path/filepath"
"strings"
"time"
)
The second part of advancedWebClient.go is as follows:
func main() { if len(os.Args) != 2 { fmt.Printf("Usage: %s URL\n", filepath.Base(os.Args[0])) return } URL, err := url.Parse(os.Args[1]) ...Read now
Unlock full access