// Set the domain of a cookie to ".example.com" cookie := http.Cookie{ Name: "my-cookie", Value: "foo", Domain: ".example.com", } // Set the domain of a cookie to the current domain req.AddCookie(&http.Cookie{ Name: "my-cookie", Value: "foo", Domain: req.Host, })In the first example, we're creating a new cookie with the domain set to ".example.com". This means that the cookie will be sent to any subdomain of example.com (e.g., www.example.com, blog.example.com, etc.). In the second example, we're setting the domain of a cookie to the current domain of the HTTP request. This is useful when you want to set a cookie for the current domain but don't want to hardcode the domain name. Both of these examples use the http.Cookie type, which is part of the Go standard library's net/http package.