It's not expected that you construct a cookie jar manually. Instead pass an http.CookieJar
interface to an http.Client
when making the request and the cookies will be automatically handled for you.
More information in this SO answer
Essentially you would use the http client, and the cookiejar implementation here:
https://golang.org/pkg/net/http/cookiejar/
To do something like:
// All users of cookiejar should import "golang.org/x/net/publicsuffix"
jar, err := cookiejar.New(&cookiejar.Options{PublicSuffixList: publicsuffix.List})
if err != nil {
log.Fatal(err)
}
client := &http.Client{
Jar: jar,
}
Example taken from here:
https://golang.org/pkg/net/http/cookiejar/#example_New