<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>ema_hiro</author_name>
  <author_url>https://blog.hatena.ne.jp/ema_hiro/</author_url>
  <blog_title>emahiro/b.log</blog_title>
  <blog_url>https://ema-hiro.hatenablog.com/</blog_url>
  <categories>
    <anon>Go</anon>
  </categories>
  <description>goはオブジェクト指向言語とは違って、書いていてC言語を書いている印象に近く、OOPで言うところのクラスが構造体で、クラスにメソッドを定義することは、構造体にメソッドを定義することになる。 しかし、クラスでカプセル化したりするわけではないので、構造体にメソッドを定義する、その定義のしかたがちょっと理解しづらかったのでそのメモ。 理解しづらかったポイント goを使って簡易的なHTTPサーバーを立てたときに、http.Handle にServeHTTPのメソッドを持つ構造体を作るって箇所で詰まって色々調べた備忘録。 package main import ( &quot;fmt&quot; &quot;net/http&quot; ) …</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fema-hiro.hatenablog.com%2Fentry%2F20170510%2F1494427060&quot; title=&quot;【go】構造体にメソッドを追加する - emahiro/b.log&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2017-05-10 23:37:40</published>
  <title>【go】構造体にメソッドを追加する</title>
  <type>rich</type>
  <url>https://ema-hiro.hatenablog.com/entry/20170510/1494427060</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
