修改您链接的确切示例,并将整数更改为字符串对我有用:package mainimport ( "container/list" "fmt")func main() { // Create a new list and put some numbers in it. l := list.New() e4 := l.PushBack("4") e1 := l.PushFront("1") l.InsertBefore("3", e4) l.InsertAfter("2", e1) // Iterate through list and print its contents. for e := l.Front(); e != nil; e = e.Next() { fmt.Println(e.Value) }}