• mrkite
    link
    fedilink
    arrow-up
    7
    ·
    1 year ago

    So it’s not really a problem with for loops, it’s a problem with closures inside for loops.

  • lightsecond
    link
    fedilink
    arrow-up
    5
    ·
    1 year ago

    As someone just learning Go, the current behaviour is really unexpected. I’m happy that they are changing it.

    • bmarinov@lemmy.world
      link
      fedilink
      arrow-up
      7
      ·
      edit-2
      1 year ago

      As someone with years of Go experience, this thing bites me or my team in the ass at least once every six months. Sometimes tests catch it, other times the tests get written after the fact and made to fit the implementation. Hilarious bug hunts ensue. I’m happy for this proposal moving forward.

  • austinM
    link
    fedilink
    English
    arrow-up
    4
    ·
    1 year ago

    Much needed change, I wish they made it apply for all go versions though