title: Unpack slices on assignment?
body: <p>Is there an elegant way in Go to do multiple assignments from arrays like in Python? Here is a Python example of what I'm trying to do (split a string and then assign the resulting array into two variables).</p>
  
  <pre><code>python:
  &gt;&gt;&gt; a, b = "foo;bar".split(";")
  </code></pre>
  
  <p>My current solution is:</p>
  
  <pre><code>x := strings.Split("foo;bar", ";")
  a, b := x[0], x[1]
  </code></pre>
  
  <p>I'm can see this getting messy in some constructs. The practical example I'm currently facing is a bookmark file parsing and assigning to a map:</p>
  
  <pre><code>bookmark := make(map[string]string)
  x := strings.Split("foo\thttps://bar", "\t")
  name, link := x[0], x[1]
  bookmark[name] = link
  </code></pre>
  
  <p>Now I have a useless variable <code>x</code> sitting around. I'd like to do something like:</p>
  
  <pre><code>bookmark := make(map[string]string)
  name, line := strings.Split("foo\thttps://bar", "\t")
  bookmark[name] = link
  </code></pre>
  
  <p>but that's invalid.</p>