title: Properties of slice of structs as function argument without allocating slice
body: <p>I have a slice of structs that looks like:</p>
  
  <pre><code>type KeyValue struct {
    Key   uint32
    Value uint32
  }
  
  var mySlice []Keyvalue
  </code></pre>
  
  <p>This slice <code>mySlice</code> can have a variable length.</p>
  
  <p>I would like to pass all elements of this slice into a function with this signature:</p>
  
  <pre><code>takeKeyValues(keyValue []uint32)
  </code></pre>
  
  <p>Now I could easily allocate a slice of <code>[]uint32</code>, populate it with all the keys/values of the elements in <code>mySlice</code> and then pass that slice as an argument into <code>takeKeyValues()</code>...</p>
  
  <p>But I'm trying to find a way of doing that without any heap allocations, by directly passing all the keys/values on the stack. Is there some syntax trick which allows me to do that?</p>