Is it possible to have a struct in go that can also be accessed as a slice? So, for example, I'd want something like this:
type Item struct {
Name string
}
type ItemList struct {
PackDate time.Time
[]Item
}
And then I could access an Item in the ItemList as a slice.
myItemList[0].Name
Or access the members of ItemList in the normal struct way.
myItemList.PackDate
If this is not possible, are there any recommended patterns for handling a sort of slice with metadata like this in go?