Based on studying large bodies of existing code, you should be about 25x more scared right now that there's an undetected bug in your code from the existing semantics -- especially if you haven't written many tests. If this change does cause a failure in existing code, we have a tool to help isolate it down to the line, still working on the end-user/programmer packaging for that tool but it is based on one we used internally for compiler debugging.
On Tuesday, April 4, 2023 at 2:57:58 AM UTC-4 Marcello H wrote: > The "scary" thing is, that if people don't have enough tests, they are > probably not aware of such a bug, or can they still be aware somehow? > > Op maandag 3 april 2023 om 20:19:33 UTC+2 schreef drc...@google.com: > >> And if there is a problem, let us know. Probably around the time 1.21 is >> released we should write up "how to debug this problem if you see it" but >> we've been working on the tools to automate the search if/when such a bug >> appears. >> >> On Saturday, March 25, 2023 at 10:12:43 AM UTC-4 Eli Bendersky wrote: >> >>> On Sat, Mar 25, 2023 at 2:33 AM Amnon <amn...@gmail.com> wrote: >>> >>>> Thanks for a very succinct response. >>>> >>>> So if I understand the CL, there will be no change in behaviour in >>>> 1.21, unless you set GOEXPERIMENT=loopvar >>>> >>>> - Amnon >>>> >>> >>> That's correct. You (and everyone else) can play with this GOEXPERIMENT >>> in 1.21 (or now, if using gotip). The most useful thing to do would be to >>> run your tests with this experiment set and see what breaks. >>> >>> Looking towards the future, this is also related to the forward >>> compatibility proposal: https://github.com/golang/go/issues/57001 >>> >>> Eli >>> >>> >>> >>> >>> >>>> >>>> >>>> >>>> On Saturday, 25 March 2023 at 06:56:23 UTC Sean Liao wrote: >>>> >>>>> https://go.dev/issue/57969 >>>>> >>>>> - sean >>>>> >>>>> On Sat, Mar 25, 2023, 06:45 Amnon <amn...@gmail.com> wrote: >>>>> >>>>>> Hi Gophers, >>>>>> Last year there was a discussion about removing one of the >>>>>> more common gotchas in Go. >>>>>> >>>>>> To quote from the discussion: >>>>>> >>>>>> the problem is that loops like this one don’t do what they look like >>>>>> they do: >>>>>> >>>>>> var all []*Item >>>>>> for _, item := range items { all = append(all, &item) } >>>>>> >>>>>> That is, this code has a bug. After this loop executes, all contains >>>>>> len(items) identical pointers, each pointing at the same Item, >>>>>> holding the last value iterated over. This happens because the item >>>>>> variable is per-loop, not per-iteration: &item is the same on every >>>>>> iteration, and item is overwritten on each iteration. >>>>>> https://github.com/golang/go/discussions/56010 >>>>>> >>>>>> What was the resolution of this discussion? >>>>>> Was the proposed change accepted? >>>>>> Will it be released in Go 1.21 or 1.22? >>>>>> >>>>>> It is hard to figure this out from the discussion. There are hundreds >>>>>> of comments, >>>>>> but there is no clear marking of the resolution (apart from the >>>>>> discussion now being closed) either at the top of bottom of the >>>>>> discussion. >>>>>> >>>>>> >>>>>> -- >>>>>> You received this message because you are subscribed to the Google >>>>>> Groups "golang-nuts" group. >>>>>> To unsubscribe from this group and stop receiving emails from it, >>>>>> send an email to golang-nuts...@googlegroups.com. >>>>>> To view this discussion on the web visit >>>>>> https://groups.google.com/d/msgid/golang-nuts/5d88208e-fbbf-44d5-b693-50deff176fedn%40googlegroups.com >>>>>> >>>>>> <https://groups.google.com/d/msgid/golang-nuts/5d88208e-fbbf-44d5-b693-50deff176fedn%40googlegroups.com?utm_medium=email&utm_source=footer> >>>>>> . >>>>>> >>>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "golang-nuts" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to golang-nuts...@googlegroups.com. >>>> >>> To view this discussion on the web visit >>>> https://groups.google.com/d/msgid/golang-nuts/aba5e0bd-c676-45f0-a7b7-ce6e23985124n%40googlegroups.com >>>> >>>> <https://groups.google.com/d/msgid/golang-nuts/aba5e0bd-c676-45f0-a7b7-ce6e23985124n%40googlegroups.com?utm_medium=email&utm_source=footer> >>>> . >>>> >>> -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/f81cf3a2-acf3-4f19-aa00-5107ebaf1105n%40googlegroups.com.