在Go中,我如何迭代指针列表?

Buf*_*lls 2 go

我想迭代这个:

*list.List
Run Code Online (Sandbox Code Playgroud)

我该怎么做?

func Foo(key string, values *list.List) string {
...

//I want to iterate and get value from "values"
}
Run Code Online (Sandbox Code Playgroud)

这个Foo被称为这样:

kvs := make(map[string]*list.List)
res := Foo(k, kvs[k]) //k is string
Run Code Online (Sandbox Code Playgroud)

谢谢!

One*_*One 5

查看示例@ 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 ""
}
Run Code Online (Sandbox Code Playgroud)

//编辑:检查创建列表的Golang地图