1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
package pages import ( "gosten/session" "net/http" ) func Logout() http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { s := session.From(r) s.Invalidate() s.Save(w, r) http.Redirect(w, r, "/", http.StatusFound) } }