Is there a way to specify the type that goes into lists in Go? I am new to Go and most of what I see from Google searches mentions slices and I even meant to ask this question. I am stuck with the code with lists and can't modify to slices.
The documentation mentions that lists use an interface for the element.
I ask because I wrote this code:
a := list.New()
a.PushBack(x)
and got this error from the code that runs my file.
panic: interface conversion: interface {} is int, not fileA.TypeA
My hunch is to create a list that only accepts fileA.TypeA
but am open to suggestions if there are other ways to fix this.