title: Golang compile environment variable into binary
body: <p>If I compile this program</p>
  
  <pre><code>package main
  
  import (
      "fmt"
      "os"
  )
  
  var version = os.Getenv("VERSION")
  
  func main() {
      fmt.Println(version)
  }
  </code></pre>
  
  <p>It prints the env var when I run it</p>
  
  <pre><code>VERSION="0.123" ./example
  &gt; 0.123
  </code></pre>
  
  <p>Is there a way to compile the env var into the binary, for example:</p>
  
  <pre><code>VERSION="0.123" go build example.go
  </code></pre>
  
  <p>Then get the same output when I run</p>
  
  <pre><code>./example
  </code></pre>