This is a basic example in go using container/list and structs.
package main
import "fmt"
import "container/list"
type Person struct {
    name string
    age  int
}
func main() {
    person1 := Person{"John", 44}
    person2 := Person{"Julia", 22}
    list := list.New()
    list.PushBack(person1)
    list.PushBack(person2)
    // Iterate the list
    for e := list.Front(); e != nil; e = e.Next() {
        itemPerson := Person(e.Value.(Person))
        fmt.Println(itemPerson.name)
    }
}
    
Top comments (1)
I didn't know the package, thanks to share :)