I need to delete a cookie, and then display a "Logged out" page. I can't do both in one HandleFunc because, the Response is already written. Here's my code -- changing the order of renderTemplate and SetCookie doesn't help:
renderTemplate(w, "templates/logout.html", nil)
log.Println("Attempting to delete cookie:", app.CookieName)
http.SetCookie(w, &http.Cookie{
Name: app.CookieName,
Value: "",
Domain: ".example.com",
Path: "/",
HttpOnly: true,
MaxAge: -1})
What's the best way to do this?