go 疑难杂症
func Test_doSeond(t *testing.T) { msg := make([]Msg, 0) for i := 0; i < 5; i++ { m := Msg{ data: []byte(strconv.Itoa(i)), addr: "wewe", } msg = append(msg, m) } m := make([]*Msg, 0) for _, v := range msg { m = append(m, &v) } for _, v := range m { fmt.Println(string(v.data)) } time.Sleep(10 * time.Second) }
自己跑下结果,会出人意料哦~~~
相关推荐
Roka 2020-06-28
xhpscdx 2020-05-17
chaigang 2020-02-25
歆萌 2020-02-02
chunianyo 2019-12-21
疯狂紫萧 2019-12-14
PHP淮北PHP00网 2013-09-17
QCkiss 2019-11-04
歆萌 2019-11-03
Kwong 2019-10-22
宇智波鼬 2018-08-30
zhrookie 2011-11-18
81423067 2015-06-02
wewoor 2015-12-27
lizaochengwen 2019-03-19
stSahana 2016-11-01
yangno 2017-03-23