Personal Git forge.
package libimport ( "net/http" "time")func DeleteCookie(w http.ResponseWriter, name string) { cookie := &http.Cookie{ Name: name, Value: "", Expires: time.Unix(0, 0), // Past date / delete MaxAge: -1, Path: "/", } http.SetCookie(w, cookie)}func SetCookie(w http.ResponseWriter, name string, value string) { http.SetCookie(w, &http.Cookie{ Name: name, Expires: time.Now().AddDate(0, 0, SessionDurationDays), HttpOnly: true, Secure: true, // send cookie only over HTTPS SameSite: http.SameSiteLaxMode, Value: value, Path: "/", })}