先看一下官网的原话 https://golang.google.cn/blog/go1.22 :The long-standing “for” loop gotcha with accidental sharing of loop variables between iterations is now resolved.简单来说就是循环时候的变量不再共享一个地址,官网给的demo不好观察其中的状况

- 阅读全文 -