/* * @Author: Bartuccio Antoine * @Date: 2018-07-16 12:22:24 * @Last Modified by: klmp200 * @Last Modified time: 2018-07-17 23:27:27 */ package gowebframework import ( "net/http" "time" ) func AddCookie(w http.ResponseWriter, name string, data string, lifetime time.Duration) { cookie := http.Cookie{ Name: name, Value: data, Expires: time.Now().Add(lifetime), } http.SetCookie(w, &cookie) }