I\'m trying to set cookies with Go\'s net/http package. I have:
package main import \"io\" import \"net/http\" import \"time\" func indexHandler(w http.Res
First, you need to create Cookie and then using http package's SetCookie() function you can set the cookie.
expire := time.Now().Add(10 * time.Minute) cookie := http.Cookie{Name: "User", Value: "John", Path: "/", Expires: expire, MaxAge: 90000} http.SetCookie(w, &cookie)