title: How to modify a slice element which is a struct in golang?
body: <p>You have a golang slice of structs and you would like to change one entry in there. </p>
  
  <pre><code>type Type struct {
      value int
  }
  
  func main() {
  
      s := []Type{{0}, {0}}
  
      // Prints  [{0} {0}]
      fmt.Println(s)
  
      firstEntry := s[0]
      firstEntry.value = 5
  
      // Also prints [{0} {0}]
      fmt.Println(s)
  }
  </code></pre>
  
  <p><a href="https://play.golang.org/p/32tpcc3-OD" rel="noreferrer">https://play.golang.org/p/32tpcc3-OD</a></p>
  
  <p>Using the brackets operator and modifying its return does not change the slice itself. </p>
  
  <p>What is the recommended way of doing this slice entry modification ? </p>