Skip to content

Instantly share code, notes, and snippets.

@fwojciec
Last active July 23, 2018 09:14
Show Gist options
  • Save fwojciec/6938af8ee73a89db14dbe36cb6670cee to your computer and use it in GitHub Desktop.
Save fwojciec/6938af8ee73a89db14dbe36cb6670cee to your computer and use it in GitHub Desktop.
My solution to "Exercise body" from Section 01 of Francesc Campoy's Go Web Workshop
// https://github.com/campoy/go-web-workshop/blob/master/section01/README.md
package main
import (
"fmt"
"io/ioutil"
"log"
"net/http"
)
func main() {
res, err := http.Get("https://golang.org")
if err != nil {
log.Fatal(err)
}
b, err := ioutil.ReadAll(res.Body)
if err != nil {
log.Fatal(err)
}
fmt.Printf("body = %+v\n", string(b))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment