Skip to content

Instantly share code, notes, and snippets.

@fwojciec
Created July 23, 2018 07:00
Show Gist options
  • Save fwojciec/4e19a1b3dc721aa69ee67c5b92dec3e4 to your computer and use it in GitHub Desktop.
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
// 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