<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>imagawa_yakata</author_name>
  <author_url>https://blog.hatena.ne.jp/imagawa_yakata/</author_url>
  <blog_title>今川館</blog_title>
  <blog_url>https://imagawa.hatenadiary.jp/</blog_url>
  <categories>
    <anon>Go初学者</anon>
  </categories>
  <description>Goのmapやスライスを操作するコードを書いていて、やたらとレビュー指摘をもらったのでここにダメな操作と大丈夫な操作をメモしておく。例えば、こういうコードは余計なことをしているので直しなさいという指摘をもらった。 package main import &quot;fmt&quot; func main() { m := map[string][]int{} xs, ok := m[&quot;foo&quot;] if !ok { xs = []int{} // nilのスライスが取れるから初期化した方がいいんじゃないか・・？ } xs = append(xs, 10) m[&quot;foo&quot;] = xs fmt.Println(m) }…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fimagawa.hatenadiary.jp%2Fentry%2F2019%2F08%2F02%2F102606&quot; title=&quot;Goのnilのmapやスライスで許されない操作 - 今川館&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>2019-08-02 10:26:06</published>
  <title>Goのnilのmapやスライスで許されない操作</title>
  <type>rich</type>
  <url>https://imagawa.hatenadiary.jp/entry/2019/08/02/102606</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
