<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>daisuzu</author_name>
  <author_url>https://blog.hatena.ne.jp/daisuzu/</author_url>
  <blog_title>daisuzu's notes</blog_title>
  <blog_url>https://daisuzu.hatenablog.com/</blog_url>
  <categories>
    <anon>Go</anon>
    <anon>vim</anon>
  </categories>
  <description>Goの既存コードを修正するツールを作る時、 既存コードをどう書き換えて 出力して テストするか を考えなければいけないのが少し面倒だと思っていました。 が、golang.org/x/tools/go/analysisのSuggestedFixを使えばすごく簡単にできてしまいます。 golang.org/x/tools/go/analysisは staticcheckやgolangci-lintなどの静的解析ツールでよく使われているパッケージです。 例えば以下のような、関数の引数にcontext.Contextがあるかどうかチェックするツールがあったとして、 func run(pass *ana…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fdaisuzu.hatenablog.com%2Fentry%2F2021%2F01%2F28%2F121303&quot; title=&quot;go/analysisのSuggestedFixでコードを修正する - daisuzu&amp;#39;s notes&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/d/daisuzu/20210128/20210128120803.gif</image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2021-01-28 12:13:03</published>
  <title>go/analysisのSuggestedFixでコードを修正する</title>
  <type>rich</type>
  <url>https://daisuzu.hatenablog.com/entry/2021/01/28/121303</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
