package main import ( "net/http" "time" ) func main() { cookie := http.Cookie{ Name: "example", Value: "foo", Secure: true, HttpOnly: true, Expires: time.Now().Add(24 * time.Hour), } req, err := http.NewRequest("GET", "https://example.com", nil) if err != nil { // Handle error } req.AddCookie(&cookie) }In this example, we create a new HTTP cookie with the name "example" and value "foo". Setting `Secure` to true ensures that the cookie will only be sent over HTTPS connections. The `HttpOnly` attribute prevents JavaScript from accessing the cookie. The `Expires` attribute sets the cookie to expire after 24 hours. The `http.NewRequest` function is used to create a new HTTP request with the method "GET" and URL "https://example.com". We then add the cookie to the request with `req.AddCookie(&cookie)`. The package library for this example is `net/http`.