<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>PlugOut</author_name>
  <author_url>https://blog.hatena.ne.jp/PlugOut/</author_url>
  <blog_title>Unknown Region</blog_title>
  <blog_url>https://plugout.hateblo.jp/</blog_url>
  <categories>
    <anon>Golang</anon>
  </categories>
  <description>思いがけずにハマってしまったので、色々と自戒を込めて備忘録がてらにメモ。 Go言語では変数定義に色々なパターンがあるが、特に:=を用いた短縮記法がよく使われる。 この短縮記法を用いた変数定義で、割とレビューでは気付きにくい問題が発生することがある。 具体的に問題を再現したコードは以下の通り。 例: main1.go package main import &quot;fmt&quot; func main() { msg := &quot;xxx&quot; // ifでもforでも良いが、ここでブロック. { msg, err := exec() // この行が落とし穴. if err != nil { panic(err) } …</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fplugout.hateblo.jp%2Fentry%2F2025%2F06%2F03%2F000000&quot; title=&quot;【Go言語】ブロックまたぎの代入が絡む複数の変数定義にご注意を - Unknown Region&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>https://cdn-ak.f.st-hatena.com/images/fotolife/P/PlugOut/20250602/20250602103852.png</image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2025-06-03 00:00:00</published>
  <title>【Go言語】ブロックまたぎの代入が絡む複数の変数定義にご注意を</title>
  <type>rich</type>
  <url>https://plugout.hateblo.jp/entry/2025/06/03/000000</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
