@architxkumar Lol yeah 😅
Got a bit cocky with my script, didnt run go vet or anything
In hindsight it feels so obvious like how can you even make that mistake
It is suchhh a basic af rule with waitgroup
I didnt even get as far as the debugger though 😂😂
The IDE warning called me out first 👀
Just sharing a subtle bug in my #golang script that taught me a lot about #goroutine scheduling & WaitGroup etiquette.
We wrote a script to start N #goroutines, but it ran intermittently.
Sometimes all tasks processed, sometimes only some.
Interestingly VS IDE even warns about this!
…but only if wg.Add() is the very first line in the #goroutine. 🥲
Any loggers or other statements before it and the warning disappears.
This warning nudged me to restructure my code when I was testing a simpler version locally.
Quick Review of the book - Def a great read but not beginner friendly so would recommend completing your #golang basics before reading.
The book helped me understand how useful channels are for controlling Goroutines and visualize them.
Personal notes: https://t.co/knIJH9Dlef
Took me 3 months, but I FINALLYYY finished Concurrency in Go by Katherine Cox. 👩💻🥳
Shoutout to ALL the GopherCon Speakers, @k0dvb, @MadhavJivrajani, @karan_6864 & many more - your content helped me connect the dots whenever I got stuck! 🫶🫶
And of course, GPT too. 🤖
#golang
GCI Talks are now live on YouTube! Explore insightful sessions and gain valuable perspectives from industry experts.
Check out the complete playlist here: https://t.co/nXLXWKcZh6
Stay tuned – Flash Talks are coming soon!
#Gci24#GopherconIndia2024
Summarized Key Differences in Behavior:
- Pointer Receiver (SafeWithdraw):
The same mutex is shared, ensuring proper mutual exclusion with sequential updates
- Value Receiver (Withdraw):
Each goroutine gets a copy of the mutex, can lead to race condition & inconsistent updates.
We have two functions; one with value receiver and another with pointer receiver.
The goal: Simulate concurrent withdrawals, where one goroutine might be blocked by another due to the mutex.
Playground: https://t.co/cud9fvUp2d
PFA the warning I encountered while exploring the behavior of the sync.Mutex package.
I understood using a value receiver for the Withdraw function isn’t ideal - it doesn’t update the original balance, but I wanted to dive deeper into how copied locks can disrupt synchronization
A thread on understanding why Go warns about 'passes lock by value' when dealing with sync.Mutex 🧵⬇️
👉 Prerequisite: A basic understanding of how sync.Mutex works for locking critical sections in concurrent programming. Ready? Let’s dive in! 🚀
Exciting announcement!
The GopherCon India 2024 talks will be available shortly on YouTube! Get ready for a series of insightful talks that dive deep into the latest trends, innovations, and best practices in the Go programming world.
Stay tuned for the release!
#GCI2024
@matryer How does item know its value in each loop iteration when we should have the final value as five?
What should I Google to understand this behavior better?
Is this immediate evaluation and delayed execution, meaning each loop has evaluated "item" BUT deferring the print execution?
Hi @matryer
Watching your talk on Defer from the London Gophers 2020 conf.
Im getting output as "ten nine eight.." and cant figure out what Im missing.
Can you help me understand if there’s a change in Go regarding defer function scope or closures? #golang
https://t.co/UYNhlI4vyI
Spent the evening fixing a minor bug 🕵️♀️
But it led to a great learning moment.
Have a better understanding of function behavior wrt value vs. pointer arguments in #golang
Malika 🤝 Go's pointer & value receiver concepts.