title: Getting undefined for a nested struct property
body: <p>(The previously linked "answer" does not answer this question.  stackoverflow.com/questions/24809235/initialize-a-nested-struct. Please do not close this question unless you can provide a clear answer.)</p>
  
  <p>In this nested struct example <code>testJSON</code>, I'm getting an error <code>Foo is undefined</code>.</p>
  
  <p><a href="https://play.golang.com/p/JzGoIfYPNjZ" rel="nofollow noreferrer">https://play.golang.com/p/JzGoIfYPNjZ</a></p>
  
  <p>Not sure what the correct way to assign values using <code>TestStruct</code> are in the case of the <code>Foo</code> property.</p>
  
  <pre><code>// TestStruct a test struct
  type TestStruct struct {
      Foo struct {
          Thing string `json:Thing`
      } `json:Foo`
  }
  
  var testJSON = TestStruct{
      Foo: Foo{
          Thing: "test thing string",
      },
  }
  </code></pre>