title: Easy way to get data inside nested struct
body: <p>I have a struct that looks like this:</p>
  
  <pre><code>&amp;main.INI{
    Properties: []*main.Property{
      &amp;main.Property{
        Key: "a",
        Value: &amp;main.Value{
          String: &amp;"a",
        },
      },
      &amp;main.Property{
        Key: "b",
        Value: &amp;main.Value{
          Number: &amp;123,
        },
      },
    },
    Sections: []*main.Section{
      &amp;main.Section{
        Identifier: "numbers",
        Properties: []*main.Property{
          &amp;main.Property{
            Key: "a",
            Value: &amp;main.Value{
              Number: &amp;10.3,
            },
          },
          &amp;main.Property{
            Key: "b",
            Value: &amp;main.Value{
              Number: &amp;20,
            },
          },
        },
      },
      &amp;main.Section{
        Identifier: "strings",
        Properties: []*main.Property{
          &amp;main.Property{
            Key: "a",
            Value: &amp;main.Value{
              String: &amp;"\"quoted\"",
            },
          },
          &amp;main.Property{
            Key: "b",
            Value: &amp;main.Value{
              String: &amp;"b",
            },
          },
        },
      },
    },
  }
  </code></pre>
  
  <p>Which is the AST of the following source code:</p>
  
  <pre><code>a = "a"
  b = 123
  
  # A comment
  [numbers]
  a = 10.3
  b = 20
  
  ; Another comment
  [strings]
  a = "\"quoted\""
  </code></pre>
  
  <p>And I would like to know if would be possible to get all keys inside <code>sections -&gt; properties -&gt; key</code></p>
  
  <p>Without having to create 2 loops:</p>
  
  <pre><code>var keys []string
  for _, section := range ini.Sections {
      for _, property := range section.Properties {
          keys = append(keys, property.Key)
      }
  }
  </code></pre>
  
  <p>I'm also working in another program that generates an AST that requires 3 nested loops to get a specific property. Is there a better way to do it? A package or something?</p>
  
  <p>I found <code>go-funk</code>, that provides a <code>.Get</code> method:</p>
  
  <pre><code>funk.Get(ini, "Sections.Properties.Key").([]string)
  </code></pre>
  
  <p>But it's not maintained.</p>
  
  <p>Thank you.</p>