<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>anatofuz</author_name>
  <author_url>https://blog.hatena.ne.jp/anatofuz/</author_url>
  <blog_title>Acme::AnaTofuZ-&gt;new;</blog_title>
  <blog_url>https://anatofuz.hatenablog.com/</blog_url>
  <categories>
  </categories>
  <description>golangにはビルド時のリンク関連の制御のldflagsオプションがある。 ldflagsを利用するとビルド時に変数の埋め込みなどが出来るのだが、これで引っかかった。 やろうとしていたことは次の様なコード。 環境変数の代わりにldflagsで変数埋め込みを行い、実行する場合は環境変数の設定を無くしたかった。 package main import ( &quot;fmt&quot; &quot;os&quot; ) var envtest string = os.Getenv(&quot;ENVTEST&quot;) func main() { fmt.Println(envtest) } 実際にこれを go build -ldflags &quot;-X m…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fanatofuz.hatenablog.com%2Fentry%2F2020%2F06%2F16%2F214638&quot; title=&quot;golangのldflagsに引っかかった - Acme::AnaTofuZ-&amp;gt;new;&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>2020-06-16 21:46:38</published>
  <title>golangのldflagsに引っかかった</title>
  <type>rich</type>
  <url>https://anatofuz.hatenablog.com/entry/2020/06/16/214638</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
