如何在Go中删除Cookie

I've set a cookie and can see it in my browser. I couldn't find anyway to remove it. What I've tried was:

deleteCookie, _ := r.Cookie("login")
deleteCookie.Value = "" 
deleteCookie.MaxAge = -1
http.SetCookie(w, deleteCookie)

But the cookie is still there with it's original value after running this code.

Try this:

http.SetCookie(w, &http.Cookie{
     Name: "login",
     MaxAge: -1,
     Expires: time.Now().Add(-100 * time.Hour),// Set expires for older versions of IE
     Path: pathUsedToSetCookie,
})

where pathUsedToSetCookie is whatever path you used to create the original cookie.

Do not reuse the request cookie. The Name field is the only field you need from the request cookie, but you know that already.