title: How to insert a variable in to a multiline (backtick) string in Go?
body: <p>I am trying to insert a variable in to a string that I pass in to a byte array. What I want is something like this:</p>
  <pre><code>myLocation := &quot;foobar123&quot;
  rawJSON := []byte(`{
          &quot;level&quot;: &quot;debug&quot;,
          &quot;encoding&quot;: &quot;json&quot;,
          // ... other stuff
          &quot;initialFields&quot;: {&quot;location&quot;: ${myLocation} },
      }`)
  </code></pre>
  <p>I know that's not possible in Go as I've taken that from JS, but I would like to do something like that.</p>
  <hr />
  <p>Working with @TheFool's answer I have done this:</p>
  <pre><code>    config := fmt.Sprintf(`{
          &quot;level&quot;: &quot;debug&quot;,
          &quot;encoding&quot;: &quot;json&quot;,
          &quot;initialFields&quot;: {&quot;loggerLocation&quot;: %s },
      }`, loggerLocation)
      rawJSON := []byte(config)
  </code></pre>