title: Function which accepts array of arbitrary size as argument (is it possible in Golang?)
body: <p><strong>Q: Is there a way, in golang, to define a function which accepts an array of arbitrary length as argument?</strong></p>
  
  <p>e.g., </p>
  
  <pre><code>function demoArrayMagic(arr [magic]int){
  ....
  }
  </code></pre>
  
  <p>I have understood that in golang, array length is part of the variable type, for this reason the following function is not going to accept one arbitrary array as input</p>
  
  <pre><code>function demoArray(arr [2]int){
  ....
  }
  </code></pre>
  
  <p>This function is not going to compile with <code>arrInput [6]int</code> as input--i.e., <code>demoArray(arrInput)</code> will fail to compile. </p>
  
  <p>Also the following function, which accepts a slice argument, does not accept arrays as arguments (different types, as expected):</p>
  
  <pre><code>function demoSlice(arr []int){
  ....
  }
  </code></pre>
  
  <p>i.e., <code>demoSlice(arrInput)</code> does not compile, expects a slice not an array.</p>
  
  <p>The question is, is there a way to define a function that takes arrays of arbitrary length (arrays, NOT slice)? It looks quite strange and limiting for a language to impose this constraint.</p>
  
  <p>The question makes sense independently from the motivation, but, in my case, the reason behind is the following. I have a set of functions which takes as arguments data structures of type <code>[][]int</code>. 
  I noticed that GOB serialization for them is 10x slower (MB/s) than other data structures I have. I suppose that may be related to the chain of derefencing operations in slices. Moving from slices to array--i.e.,defining objects of type <code>[10000][128]int</code>--may improve situation (I hope). </p>
  
  <p>Regards</p>
  
  <p><strong>P.s:</strong> I remind now that Go, passes/uses things 'by value', using arrays may be overkill cause golang is going to copy them lot of times. I think <strong>I'll stay with slices</strong> and I'll try to understand GOB internals a bit.</p>