I am inserting a struct variable in the list. I am able to retrieve that inserted item in the loop but not the individual value. I am getting the error:
e.Value.name undefined (type interface {} is interface with no methods)
Code given below:
type Item struct {
name string
value string
}
queue := list.New()
per := Item{name: "name", value: "Adnan"}
queue.PushFront(per)
for e := queue.Front(); e != nil; e = e.Next() {
fmt.Println(e.Value.name)
}