Last active
August 29, 2015 14:05
-
-
Save dvas0004/e8c5d90cb1033377234b to your computer and use it in GitHub Desktop.
array golang snippet for http://wp.me/pYwLI-oS
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
/* | |
Start Webserver Section | |
*/ | |
type Page struct { | |
Title string | |
Body string | |
Alerts []string | |
} | |
func renderTemplate(w http.ResponseWriter, tmpl string, p *Page) { | |
err := templates.ExecuteTemplate(w, tmpl+".html", p) | |
if err != nil { | |
http.Error(w, err.Error(), http.StatusInternalServerError) | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment