expiration := time.Now().Add(24 * time.Hour) cookie := http.Cookie{ Name: "mycookie", Value: "some value", Expires: expiration, MaxAge: 86400, // 24 hours in seconds } http.SetCookie(responseWriter, &cookie)In this example, a new cookie is created with a maximum age of 86400 seconds (or 24 hours). The cookie will expire after this time and will be deleted from the client's browser. The package library used in this example is the "net/http" package.