It's been a while since I dealt with go and I seem to have forgotten how to read the docs.
If I do a get request like this...
resp, err := http.Get("https://example.com")
I then see that the response has a Body that is of an io.ReadCloser type (https://golang.org/pkg/io/#ReadCloser). I see the ReadCloser is an interface to Reader and Closer.
When I look at the Reader interface I see it has a Read method that reads bytes into p (https://golang.org/pkg/io/#Reader).
To recap, the http Response has a body which is a io.ReadCloser Interface which itself contains a Reader interface which has a Read method.
When I try this I would expect to Read the response bytes into HTML, but I see nothing...
var html []byte
num, err := resp.Body.Read(html)
fmt.Println("\n\thtml: ", html)
fmt.Printf("\n\tnum: %v, err: %v\n", num, err)
Output:
html: []
num: 0, err: <nil>
What am I missing here?