Wayan Jimmy's Brain

Change the actual value using the reference

Learn go with tests

Take a look at this piece of code

func (f *FileSystemPlayerStore) RecordWin(name string) {
    league := f.GetLeague()

    for i, player := range league {
        if player.Name == name {


You may be asking yourself why I am doing league[i].Wins++ rather than player.Wins++

When you range over a slice you are returned the current index of the loop (in our case i) and a copy of the element at that index

We need to get the reference to the actual value by doing league[i] and then changing the value instead.