title: Short way to apply a function to all elements in a list in golang
body: <p>Suppose I would like to apply a function to every element in a list, and then put the resulting values in another list so I can immediately use them. In python, I would do something like this:</p>
  
  <pre class="lang-py prettyprint-override"><code>list = [1,2,3]
  str = ', '.join(multiply(x, 2) for x in list)
  </code></pre>
  
  <p>In Go, I do something like this:</p>
  
  <pre><code>list := []int{1,2,3}
  list2 := []int
  
  for _,x := range list {
      list2 := append(list2, multiply(x, 2))
  }
  
  str := strings.Join(list2, ", ")
  </code></pre>
  
  <p>Is it possible to do this in a shorter way?</p>