For the curious reader: this can be solved by simply passing i as a parameter.
for i := 0; i < 10; i++ {
go func(i int) {
f(i)
}(i)
}