In this video, we are going to look at the experimental synctest package in Go 1.24. If you are also curious about what weak pointers are in Go 1.24, feel free to check out this video: https://youtu.be/4E4IPB5cstw
📝 Description
In this video, we are going to cover the experimental synctest package, which allows you to control time and goroutines in your unit tests. We are going to cover why and when to use this synctest package. Obviously, it is experimental, so things can change. Also, the unit test can definitely be improved because I would honestly say it is not a 100% proper unit test. You will learn the following things:
• What is the synctest package
• When to use the synctest package
• How to control the time using the synctest package
• What is a durably blocked goroutine
⏳ Timestamps:
00:00 - Introduction
00:30 - What is the synctest package?
02:33 - Implementing a simplified event processor
09:12 - Using the event processor
11:37 - Unit Test for the event processor
15:22 - Adding a timeout to the event processor
18:58 - Trying out the timeout in the event processor
20:48 - Timeout Unit Test
23:47 - Outro
👋 Hey there!
If you are new to this channel: Hey 👋 my name is Flo and I am a professional software engineer with a passion for coding in Golang, TypeScript, JavaScript, and Rust. This channel is where I share that passion and dive into the exciting world of software engineering.
📨 Support and Connect!
Buy me a coffee: https://www.buymeacoffee.com/florianwoelki
Become a member. https://www.youtube.com/@FloWoelki/membership
Discord: https://discord.gg/TnA7drJ
Instagram: https://www.instagram.com/flowydev/
LinkedIn: https://www.linkedin.com/in/florian-woelki/
TikTok: https://www.tiktok.com/@florianwoelki
GitHub: https://github.com/FlorianWoelki
📝 Copyright Notice
The original Go Gopher version is originally designed by Renée French (Source: https://go.dev/blog/gopher License details: https://creativecommons.org/licenses/by/4.0/). The gopher used in the video and thumbnail is inspired by this author.
#golang #go1.24 #synctest #unittest