GoにおけるCookie操作(設定・送信・取得)について気になったので、本やネットで調べて自分なりにまとめてみました。 Cookieおさらい正式には「HTTP cookie」でWebサイトへアクセスした際に、ユーザのデバイス(PCやスマホ)に残していくデータのことです。 サーバからHTTPレスポンスメッセージを通して送られるもので、クライアントに保管されます。次回以降はCookieとともにWebサーバーへアクセスするため、ユーザが保持していたCookieにあわせてページを表示することができます。 分類としてはセッションクッキーと永続性クッキーの2種類に分けられます。 Goにおけるtype Cookiehttpパッケージのtype Cookieは以下のような構造体になっています。 基本的にはhttp.Cookie型へのポインタ変数を用意し、NameフィールドにCookie名、Valueフィー