How to change elements in the list in go?

前端 未结 0 524
盖世英雄少女心
盖世英雄少女心 2021-01-18 02:49

If I use container/list as

type Data struct {
    x int
}

l := list.New()
l.PushBack(Data{2})
...
a := l.Back()
v := a.Value.(Data)
v.x = 1

相关标签:
回答
  • 消灭零回复
提交回复
热议问题