I have a struct as follows:
type MyStruct struct {
Part1 string
Part2 string
Part3 string
}
I have a string separated by slashes that I want to map to this:
part1/part2/part3
However, the string may only contain 1 part such as part1 or two parts such as part1/part2
if any part is missing it much be mapped as an empty string.
I am very new to go so wondering what the best way to achieve this is. Typically i would split the string and check the length to know what to do. In go is there a more elegant way to do this?