title: Type assertion with type from field of structure
body: <p>Here is a simplified example of what I struggle with:</p>
  <pre><code>type Dog struct {
      Bark bool
  }
  
  func myLogic(i interface{}) {
      newVar = i.(Dog)  // Work fines -&gt; newVar is of type Dog if I passed such type to the function through the interface
      newVar2 = i.(Dog.Bark) // I get an error &quot;type Dog has no method Bark&quot;
  }
  </code></pre>
  <p>How can I possibly get the type bool from the field Bark through the Dog structure here in order to use it for type assertion ??</p>