title: How to write func for the generic parameter in golang
body: <p>I am trying to write a function <code>Map</code>, so that it can handle all the types of array. </p>
  
  <pre><code>// Interface to specify generic type of array.
  type Iterable interface {
  }
  
  func main() {
      list_1 := []int{1, 2, 3, 4}
      list_2 := []uint8{'a', 'b', 'c', 'd'}
      Map(list_1)
      Map(list_2)
  }
  
  // This function prints the every element for
  // all []types of array.
  func Map(list Iterable) {
      for _, value := range list {
          fmt.Print(value)
      }
  }
  </code></pre>
  
  <p>But it throws the compile time error.</p>
  
  <pre><code>19: cannot range over list (type Iterable)
  </code></pre>
  
  <p>The error is correct because <code>range</code> require array, pointer to an array, slice, string, map, or channel permitting receive operations and here type is <code>Iterable</code>. I think problem that I am facing is, conversion of the argument type <code>Iterable</code> to array type. Please suggest, how could I use my function to handle generic array. </p>