quii / learn-go-with-tests

Learn Go with test-driven development
MIT License
22.03k stars 2.79k forks source link

Concurrency chapter - example of goroutine loop variables is no longer applicable as of go version 1.22 #740

Open rqpt opened 7 months ago

rqpt commented 7 months ago

tldr - This behaviour is something that has been addressed in the latest go release.

I am currently reading this book (excellent btw), and am coding along until I get to the '...and we're back' section of the concurrency chapter.

tdd-go-concurrency-chapter

I ran this example and my tests pass just fine.

tdd-go-concurrency-editor

I then set out to investigate why, as this should fail according to the chapter, and this video cleared things up for me - https://www.youtube.com/watch?v=Smc-6qfZ2JU

quii commented 7 months ago

Good spot! Do you fancy making a PR?

rqpt commented 7 months ago

I'll give it a shot, sure! I'll try and tackle it this weekend.