... doesn't satisfy the http.Handler interface (
http://golang.org/pkg/net/http/#Handler) as-is, so you either need to do that or just lean on the http.HandlerFunc type to do it for you. For the most part, you can just drop the session code into your existing handlers. If you want to get fancy and have separate functions (middleware) that do this for you, you'll need to write code that: a) creates the session; b) passes it to the handler via a request context; and c) saves the session before any handler writes to the http.ResponseWriter.
The "simplest" way is to just write http.HandlerFuncs.
var store = sessions.NewCookieStore([]byte("something-very-secret"))
func HelloHandler(w http.ResponseWriter, r *http.Request) {
// Get the session; noting that "Get" creates a new session if none exists yet
sess, err := store.Get(r, "my-app-name")
if err != nil {
http.Error(w, "No good", http.StatusInternalServerError)
return
}
// do things - parse POST form values, fetch the user details from a database, etc.
// user := User{Name: someDBResult, Email: someOtherDBResult}
session.Values["user"] = user
// Save the session
err := sess.Save(r, w)
if err != nil {
http.Error(w, "No good", http.StatusInternalServerError)
return
}
// Write to the http.ResponseWriter - whether it be a template, JSON response, etc.\
}