title: practical way to set and sequentially increment a value inside a map?
body: <pre class="lang-golang prettyprint-override"><code>package main
  
  import (
      "fmt"
  )
  
  var store = map[string]int{}
  
  func breadArrived(num int) {
      if breadTotal, ok := store["bread"]; ok {
          breadTotal += num
      } else {
          store["bread"] = num
      }
      fmt.Printf("%v\n", store)
  }
  
  func main() {
      breadArrived(1)
      breadArrived(2)
      breadArrived(3)
  }
  </code></pre>
  
  <p>Code above ignores the <code>+=</code> operator, so <code>store["bread"]</code> always equals to <code>1</code>. I assume I'm missing something like "passing by reference" here. Also, is there any more convenient way of doing this?</p>