<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>rhysd</author_name>
  <author_url>https://blog.hatena.ne.jp/rhysd/</author_url>
  <blog_title>はやくプログラムになりたい</blog_title>
  <blog_url>https://rhysd.hatenablog.com/</blog_url>
  <categories>
    <anon>Go</anon>
  </categories>
  <description>Go でコマンドラインツールを実装した時に $ some-tool -version のようにバージョンを出力するフラグを実装することが多いと思います．本記事はこれをどう実装するかのメモです． 手動でバージョン情報を管理 素朴にはバージョン情報を定数で持って手動で管理する方法があります． package main import ( &quot;flag&quot; &quot;fmt&quot; ) const version = &quot;1.2.3&quot; func main() { var v bool flag.BoolVar(&amp;v, &quot;version&quot;, false, &quot;Show version&quot;) flag.Parse() if v …</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Frhysd.hatenablog.com%2Fentry%2F2021%2F06%2F27%2F222254&quot; title=&quot; Go で --version の出力を実装する - はやくプログラムになりたい&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>2021-06-27 22:22:54</published>
  <title> Go で --version の出力を実装する</title>
  <type>rich</type>
  <url>https://rhysd.hatenablog.com/entry/2021/06/27/222254</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
