{"url":"https://blog.framinal.life/entry/2022/11/20/225354","published":"2022-11-20 22:53:54","blog_url":"https://blog.framinal.life/","version":"1.0","image_url":"https://cdn.user.blog.st-hatena.com/default_entry_og_image/73158536/1534511431670062","author_name":"lirlia","provider_name":"Hatena Blog","height":"190","blog_title":"\u30d5\u30e9\u30df\u30ca\u30eb","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fblog.framinal.life%2Fentry%2F2022%2F11%2F20%2F225354\" title=\"Go \u306e Option \u30d1\u30bf\u30fc\u30f3\u3092 generics \u3068 reflect \u3067\u30b7\u30f3\u30d7\u30eb\u306b\u3057\u3066\u307f\u308b - \u30d5\u30e9\u30df\u30ca\u30eb\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","width":"100%","provider_url":"https://hatena.blog","title":"Go \u306e Option \u30d1\u30bf\u30fc\u30f3\u3092 generics \u3068 reflect \u3067\u30b7\u30f3\u30d7\u30eb\u306b\u3057\u3066\u307f\u308b","type":"rich","description":"Go\u3067\u306f\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u751f\u6210\u3059\u308b New \u306b\u5bfe\u3057\u3066\u3044\u308d\u3093\u306a\u30d1\u30bf\u30fc\u30f3\u3067\u4f5c\u6210\u3092\u3059\u308b\u305f\u3081\u306b\u3001\u3088\u304f Option \u30d1\u30bf\u30fc\u30f3\u3068\u547c\u3070\u308c\u308b\u66f8\u304d\u65b9\u3092\u3057\u307e\u3059\u3002 \u3053\u3093\u306a\u611f\u3058\u3067\u3059\u3002(WithXXX \u3067\u8a2d\u5b9a\u3057\u305f\u3044\u5185\u5bb9\u3092\u4ed8\u4e0e\u3067\u304d\u308b) package main import ( \"fmt\" ) func main() { p := NewProduct( WithName(\"iPhone\"), WithId(1), WithParam(\"isLatest\", true)) fmt.Println(p) } type Option func(*product) type product struct { name strin\u2026","categories":["Golang"],"author_url":"https://blog.hatena.ne.jp/lirlia/"}