Original post

For many different reasons, there will be times when you need to keep data within a cookie to be sent with subsequent requests or read by the recipient. We can do this with Go’s standard library, or by using a package like gorilla’s session, but for this simple example we’ll use the standard library.
We’ve created a function called addCookie() which takes a name/key and a value to writes it directly against the ResponseWriter w.