{"published":"2015-01-01 17:49:33","url":"https://shin.hateblo.jp/entry/2015/01/01/174933","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fshin.hateblo.jp%2Fentry%2F2015%2F01%2F01%2F174933\" title=\"golang\u306eType Assertion\u30e1\u30e2 - $ cat /var/log/shin\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","provider_name":"Hatena Blog","title":"golang\u306eType Assertion\u30e1\u30e2","height":"190","author_name":"s-shin","blog_title":"$ cat /var/log/shin","version":"1.0","description":"Type Assertion\u306fC++\u306edynamic_cast\u7684\u306a\u6a5f\u80fd\u3002 interface\u3092\u5225\u306e\u578b\u306b\u30ad\u30e3\u30b9\u30c8\u3059\u308b\u6642\u306b\u4f7f\u7528\u3002 2\u901a\u308a\u306e\u53d7\u3051\u65b9\u304c\u3042\u308b\u3002 package main import ( \"fmt\" \"errors\" ) type MyError struct { i int } func (e *MyError) Error() string { return fmt.Sprintf(\"i = %d\", e.i) } func check1(e error) { myErr, ok := e.(*MyError) if ok { fmt.Println(myErr) } else { \u2026","blog_url":"https://shin.hateblo.jp/","author_url":"https://blog.hatena.ne.jp/s-shin/","provider_url":"https://hatena.blog","image_url":null,"type":"rich","width":"100%","categories":["go","golang"]}