Created
July 23, 2018 07:00
-
-
Save fwojciec/4e19a1b3dc721aa69ee67c5b92dec3e4 to your computer and use it in GitHub Desktop.
My solution to "Exercise status codes" 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" | |
"net/http" | |
) | |
func main() { | |
res, err := http.Get("https://golang.org/ssssdfasdfa") | |
if err != nil { | |
panic(err) | |
} | |
if res.StatusCode == 404 { | |
fmt.Println("Found an error: ", res.Status) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment