package http import ( "time" "net/http" ) func SetCookieValue(w http.ResponseWriter, host, key, newCookieValue string) { http.SetCookie(w, &http.Cookie{ Name: key, Value: newCookieValue, Path: "/", Domain: host, Expires: time.Now().UTC().AddDate(3, 0, 0), Secure: true, HttpOnly: true, }, ) } func GetCookieValue(req *http.Request, name string) (cookieValue string) { if cookie, _ := req.Cookie(name); cookie != nil { cookieValue = cookie.Value } return }