Last active
July 23, 2018 09:14
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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