In Go how can I iterate over a pointer list?

go

Solution

Check the example @ http://golang.org/pkg/container/list/ :

func Foo(key string, vl *list.List) string {
    for e := l.Front(); e != nil; e = e.Next() {
        v := e.Value
    }
    return ""
}

//edit : check Create a Golang map of Lists

Problem

I want to iterate over this : ``` *list.List ``` How can I do it? ``` func Foo(key string, values *list.List) string { ... //I want to iterate and get value from "values" } ``` this Foo is being called like this: ``` kvs := make(map[string]*list.List) res := Foo(k, kvs[k]) //k is string ``` Thanks!

Original source

Related problems