os.Getenv("INSTANCE_ID")
のように書く
1 2 3 4 5 6 |
<span class="k">import</span> <span class="s">"os"</span> <span class="k">func</span> <span class="n">getInstanceID</span><span class="p">()</span> <span class="kt">string</span><span class="p">{</span> <span class="k">var</span> <span class="n">instanceId</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">Getenv</span><span class="p">(</span><span class="s">"INSTANCE_ID"</span><span class="p">)</span> <span class="k">return</span> <span class="n">instanceId</span> <span class="p">}</span> |