Comment

malko

You should prefer to convert your string to a slice of rune to correctly iterate on a string character by character:

  word := []rune("péter")
  for i := 1; i <= len(word); i++ {
      fmt.Println(word[0:i])
  }

This will handle utf8 characters properly. Iterating on a string your are iterating on a slice of bytes which is different from characters.