This is a creation in Article, where the information may have evolved or changed.
The project needs to use the Golang queue, container/list, need to put the element is a struct, but because the design of the list in the Golang, the type from the list is interface{}, so you need to find a way to interface{} Convert to struct.
Here you need to use the interface assertion, see the following code for specific operations:
1 Package Main2 3 Import (4 "container/list"5 "FMT"6 "StrConv"7 )8 9Type peoplestruct {TenNamestring OneAgeint A } - - Func Main () { the //Create A new list and put some numbers in it. -L: =list. New () -L.pushback (people{"ZJW",1}) - + //iterate through list and print its contents. -E: =L.front () +P, OK: =(E.value). (people) A ifOK { atFmt. Println ("Name:"+p.name) -Fmt. Println ("Age :"+StrConv. Itoa (p.age)) -}Else { -Fmt. Println ("e isn't an people") - } -}