package main import ( "fmt" "io" "net/http" "os" ) type logWriter struct{} func main() { resp, err := http.Get("https://google.com") if err != nil { fmt.Println("Error!") os.Exit(1) } // bs := make([]byte, 99999) // necessary because Read() only fills a fix amount // resp.Body.Read(bs) // fmt.Println(string(bs)) lw := logWriter{} io.Copy(lw, resp.Body) } func (l logWriter) Write(bs []byte) (int, error) { fmt.Println(string(bs)) return len(bs), nil }