According to the answer at How to split a string and assign it to variables in Golang? splitting a string results in an array of strings where the separator is not present i
s := strings.SplitAfter("Potato:Salad:Popcorn:Cheese", ":")
for _, element := range s {
fmt.Println(element)
}
// Potato:
// Salad:
// Popcorn:
// Cheese