title: Undefined err variable
body: <p>As a Go "newb" I'm not sure why I'm receiving the errors <strong>undefined err</strong> and <strong>undefinded user</strong> in the console when compiling the program.</p>
  
  <p>I have:</p>
  
  <pre><code>if req.Id == nil {
      user, err := signup(C, c, &amp;req)
  } else {
      user, err := update(C, c, &amp;req)
  }
  
  if err != nil {
      c.JSON(http.StatusOK, err)
      return
  }
  
  doSomethingWith(user)
  </code></pre>
  
  <p>I realise I could probably declare the <code>err</code> and <code>user</code> variables before the conditional block but I would like to know why this doesn't work. Is it something to do with creating two new variables in one go?</p>
  
  <p><strong>UDPATE</strong>
  Getting in a bit of a mess with this.</p>
  
  <p>I've now got:</p>
  
  <pre><code>user := core.User{}
  if req.Id == nil {
      user, err := signup(C, c, &amp;req)
  } else {
      user, err := update(C, c, &amp;req)
  }
  
  cleanUser(&amp;user)
  </code></pre>
  
  <p>and my errors now are <strong>user declared and not used</strong>. I'm not tackling the <strong>err</strong> part at the moment but I'm unsure why I'm getting errors about the user.</p>