![Flo Woelki](/img/default-banner.jpg)
- 45
- 160 108
Flo Woelki
Germany
Registrace 30. 05. 2012
Creating content about software engineering with Emojis and Paper.
Go 1.23: Custom Iterators Explained - Best feature?!
Iterators in Go 1.23 can sometimes be confusing, but ultimately, they are absolutely amazing and will transform the Go library developer's life! If you are interested in how to boost your Go application's performance, feel free to check out this video: czcams.com/video/4oJ08j3mzH0/video.html
📝 Description
Discover the latest feature in Go 1.23 that's changing how we handle iterations: Custom Iterators! This video is tailored for developers eager to expand their toolkit with Go's new iteration capabilities. Here's what we'll cover:
• Understanding Range Iteration: Learn what range iteration means in Go and how it's traditionally used with slices and maps.
• Custom Iterators: Dive into how Go 1.23 allows you to create custom iterators for any data structure, not just the built-in types.
• Practical Examples: From simple to complex, see custom iterators in action. We'll create an iterator for a slice with transformation functions using the new iter package.
• Advanced Usage with iter.Seq and iter.Seq2: Explore how to handle single and dual value iterations with custom logic applied on the fly.
• Why Custom Iterators Matter: Understand the use cases where custom iterators can significantly enhance your code's readability and functionality, especially if you're into library development.
⏳ Timestamps:
00:00 - Introduction
00:28 - What are Range Iterators?
02:22 - Custom Iterator Simple Example
08:01 - Custom Iterator Map
15:00 - Iterator Seq2 Example
17:12 - 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. Plus, I love using emojis and paper-based animations (so have a look for that if you want to find my videos).
📨 Support and Connect!
Buy me a coffee: www.buymeacoffee.com/florianwoelki
Become a member. www.youtube.com/@FloWoelki/membership
Discord: discord.gg/TnA7drJ
Instagram: flowydev
LinkedIn: www.linkedin.com/in/florian-woelki/
TikTok: www.tiktok.com/@florianwoelki
GitHub: github.com/FlorianWoelki
📝 Copyright Notice
The original Go Gopher version is originally designed by Renée French (Source: go.dev/blog/gopher License details: creativecommons.org/licenses/by/4.0/). The gopher used in the video and thumbnail is inspired by this author.
#golang #go #iterators #iter
📝 Description
Discover the latest feature in Go 1.23 that's changing how we handle iterations: Custom Iterators! This video is tailored for developers eager to expand their toolkit with Go's new iteration capabilities. Here's what we'll cover:
• Understanding Range Iteration: Learn what range iteration means in Go and how it's traditionally used with slices and maps.
• Custom Iterators: Dive into how Go 1.23 allows you to create custom iterators for any data structure, not just the built-in types.
• Practical Examples: From simple to complex, see custom iterators in action. We'll create an iterator for a slice with transformation functions using the new iter package.
• Advanced Usage with iter.Seq and iter.Seq2: Explore how to handle single and dual value iterations with custom logic applied on the fly.
• Why Custom Iterators Matter: Understand the use cases where custom iterators can significantly enhance your code's readability and functionality, especially if you're into library development.
⏳ Timestamps:
00:00 - Introduction
00:28 - What are Range Iterators?
02:22 - Custom Iterator Simple Example
08:01 - Custom Iterator Map
15:00 - Iterator Seq2 Example
17:12 - 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. Plus, I love using emojis and paper-based animations (so have a look for that if you want to find my videos).
📨 Support and Connect!
Buy me a coffee: www.buymeacoffee.com/florianwoelki
Become a member. www.youtube.com/@FloWoelki/membership
Discord: discord.gg/TnA7drJ
Instagram: flowydev
LinkedIn: www.linkedin.com/in/florian-woelki/
TikTok: www.tiktok.com/@florianwoelki
GitHub: github.com/FlorianWoelki
📝 Copyright Notice
The original Go Gopher version is originally designed by Renée French (Source: go.dev/blog/gopher License details: creativecommons.org/licenses/by/4.0/). The gopher used in the video and thumbnail is inspired by this author.
#golang #go #iterators #iter
zhlédnutí: 2 982
Video
Boosting the performance by being unique in Go 1.23!
zhlédnutí 4,6KPřed dnem
Understanding the unique module in Go 1.23 is an absolute must because it will improve your performance! While this module is interesting, there have been some changes with sorting and timers as well, so feel free to check out this video: czcams.com/video/MVx_b-2TuLY/video.html 📝 Description Go 1.23 is here, and it's bringing some exciting changes! In this video, we'll dive deep into one of the...
You have to know these two Golang 1.23 changes!
zhlédnutí 2,9KPřed 14 dny
The new sorting and timer functionalities are crucial to understand in Go 1.23 because they offer much more flexibility. If you also need a quick refresher on Golang, feel free to check out this video here: czcams.com/video/P7dCWOjRwJA/video.html 📝 Description In this video, we'll dive into the sweet and meaty updates of Go 1.23, where we clarify two significant changes related to sorting and t...
Building a CLI with Rust and the GitHub API is so easy!
zhlédnutí 1,1KPřed 21 dnem
A real-world use case for Rust would be to interact with the GitHub API to retrieve all repository issues and their reactions and sort them based on upvotes. This is what we are going to build today! Also, if you want to learn more about the `?` operator in Rust, feel free to check out this video: czcams.com/video/Z6wxawIPUaw/video.html 📝 Description In this tutorial, we will be diving into a r...
Type Assertions in Go: the only guide you need!
zhlédnutí 2KPřed měsícem
Type Assertions and the Type Switch in Go are concepts that you need to understand to fully master any types in Golang! If you also need a quick refresher of Golang, feel free to check out this video here: czcams.com/video/P7dCWOjRwJA/video.html 📝 Description Struggling with determining variable types in Go interfaces? This video dives deep into type switches and type assertions - powerful tool...
A hands-on guide for proper Unit Testing in Go!
zhlédnutí 2,4KPřed měsícem
Unit testing is an essential part of scaling an application and getting a good night's sleep. This video contains explanations that include Structs, if you need a refresher what structs are, check out this video: czcams.com/video/c8H0w4yBL10/video.html 📝 Description In this video, we're diving deep into the world of unit testing in Golang. Whether you're building scalable applications or robust...
If you are a beginner in Go, avoid this Slice pitfall!
zhlédnutí 3,8KPřed měsícem
Understanding the fundamental difference between slices and arrays in Golang is a must and sometimes a pitfall for beginners. If you are a beginner and want a 15-minute crash course, feel free to watch this video as well: czcams.com/video/P7dCWOjRwJA/video.html 📝 Description In this video, we dive deep into a common pitfall that many Golang beginners encounter, which can significantly slow down...
Creating custom struct tags in Golang is awesome!
zhlédnutí 6KPřed měsícem
Creating custom struct tags in Golang is a must for every developer to simplify the lives of everyone! If you've liked this video and want more complex videos, have a look at this one as well: czcams.com/video/qcnbt4WqExw/video.html 📝 Description Dive into the world of Go struct tags in this comprehensive tutorial! Learn how to create and implement your own custom struct tags, understand the po...
Level Up Your Golang: 5 Concepts You Need to know
zhlédnutí 8KPřed měsícem
You have to know these 5 concepts and keywords in Golang to improve your Golang code! An additional one are variadic functions, luckily I've also made a video about this concept: czcams.com/video/hXqwPsXXf8c/video.html 📝 Description Dive deep into the fascinating world of Golang as we explore five powerful yet often overlooked concepts that can supercharge your coding skills. In this video, we'...
Why I switched from VSCode to Zed.
zhlédnutí 24KPřed 2 měsíci
VSCode can be really slow, especially with larger codebases. Luckily, there are some alternatives, and one of them is Zed. Zed was made in Rust, and if you want to know how Rust can replace Electron, check out this video: czcams.com/video/YmDKih6oJK4/video.html 📝 Description In this video, we take an in-depth look at Zed, a new open-source editor that's faster than Sublime Text and VSCode. We d...
The Spread Operator (or Variadic Functions) in Golang
zhlédnutí 1,1KPřed 2 měsíci
Variadic functions are a fundamental concept to understand to allow developers to specify varying lengths of arguments. And if you also need a 15-minute crash course about Golang, then I highly recommend watching this video here: czcams.com/video/P7dCWOjRwJA/video.html 📝 Description In this video, we delve deep into the world of variadic functions in Go. As a developer, defining functions can s...
DIY Golang Web Server: No Dependencies Needed!
zhlédnutí 6KPřed 2 měsíci
Building a web server from scratch without any third-party dependencies is so easy in Golang. And if you also need a 15-minute crash course about Golang, then I highly recommend watching this video here: czcams.com/video/P7dCWOjRwJA/video.html 📝 Description In this video, we explore how to build a web server with Golang without any dependencies. We delve into the new features brought by Golang ...
Golang: The Last Interface Explanation You'll Ever Need
zhlédnutí 11KPřed 3 měsíci
Interfaces are common, easy and important to use in Golang. Next to interfaces, structs are also really important. I've also made a video about them, so feel free to check out this video as well: czcams.com/video/c8H0w4yBL10/video.html 📝 Description This time we're tackling interfaces, a vital component of Go and a must-have in every Go developer's toolkit. We'll start off with the basics of de...
Defer Functions In Golang: Everything You Need To Know
zhlédnutí 935Před 3 měsíci
The defer keyword in Go is a powerful feature you must know! Structs are also really common in Golang and that's why I highly recommend watching this video here as well: czcams.com/video/c8H0w4yBL10/video.html 📝 Description In this video, we dive deep into one of the most useful and powerful features in Golang-the defer keyword. This concept allows for deferred processing that executes a functi...
You are providing fallback values in Golang wrong!
zhlédnutí 2,3KPřed 3 měsíci
Golang 1.22 has a brand new feature, the cmp.Or function. If you want to know everything about structs, I highly recommend watching this video: czcams.com/video/c8H0w4yBL10/video.html. 📝 Description In this video, we delve into the power and versatility of the `cmp.Or` function in Golang. This function, a part of the `cmp` package, allows us to streamline our code and make it more readable and ...
Actix Web Extractors: JSON, Query, Path Param, and Form
zhlédnutí 601Před 3 měsíci
Actix Web Extractors: JSON, Query, Path Param, and Form
This is your last video about Golang Structs!
zhlédnutí 4,6KPřed 3 měsíci
This is your last video about Golang Structs!
The lesser-known Symbol in JavaScript and TypeScript
zhlédnutí 429Před 4 měsíci
The lesser-known Symbol in JavaScript and TypeScript
How Go 1.22 fixed an issue that caused Google problems
zhlédnutí 1,4KPřed 4 měsíci
How Go 1.22 fixed an issue that caused Google problems
Rust error handling made easier with the ?-operator
zhlédnutí 1,1KPřed 4 měsíci
Rust error handling made easier with the ?-operator
Why HTMX and Golang? The answer might surprise you...
zhlédnutí 10KPřed 4 měsíci
Why HTMX and Golang? The answer might surprise you...
Goodbye Electron and JavaScript. Hello Tauri and Rust!
zhlédnutí 19KPřed 5 měsíci
Goodbye Electron and JavaScript. Hello Tauri and Rust!
What are Template Literal Types in TypeScript?
zhlédnutí 230Před 5 měsíci
What are Template Literal Types in TypeScript?
Will Software Engineers be replaced by AI (or Devin)?
zhlédnutí 175Před 5 měsíci
Will Software Engineers be replaced by AI (or Devin)?
Build Blazing Fast Backends with Rust & Actix Web
zhlédnutí 11KPřed 5 měsíci
Build Blazing Fast Backends with Rust & Actix Web
Go from Zero to Hero: Learn Golang in 15 minutes!
zhlédnutí 3,7KPřed 6 měsíci
Go from Zero to Hero: Learn Golang in 15 minutes!
Docker's hidden Init Command (+Rust Web Server in 60s)
zhlédnutí 2,5KPřed 6 měsíci
Docker's hidden Init Command ( Rust Web Server in 60s)
How did I not know this TypeScript type trick earlier?
zhlédnutí 1,9KPřed 6 měsíci
How did I not know this TypeScript type trick earlier?
Master Rust File Handling in One Line
zhlédnutí 1,6KPřed 6 měsíci
Master Rust File Handling in One Line
var, let, and const: What is the Big Difference!
zhlédnutí 197Před 6 měsíci
var, let, and const: What is the Big Difference!
Umm I am trying to think in a situacion where i compare in a loop the same data. I know you do that just for explanation but we alway are compairing Dinamically data not static
For me go to is label break just for bring some clarity. Because goto outherloop is better that just break
omg, does he think RC checks for items and delete the vector when item count is zero ? 5:20
thank God I'm not the only one confused
what code editor do you use atm and in this vid?
I use the Zed Editor :)
It's like a dog scratching his right ear with his left leg. Terrible syntactic choices, in my opinion.
Again, fix the Go Gopher art or this entire playlist is copyright infringement
Thank you for the information. Would a short notice in the CZcams description be enough, or what do you recommend?
Hey - you cannot misrepresent the Go Gopher like that in your thumbnail - fix it or it is getting reported. The rules are clear about the Go Gopher, you can’t just make up your own version. You have 3 days.
@@pookiepats Why? Where is that?
Thank you for the notice. I am in contact with the official Golang trademark team to clarify this situation.
Its confusing af. All the callback and syntactic sugar kind of hard to understand
Try coding similar behavior yourself without the syntactic sugar and the runtime hack that allows you to use range func(yield func[V any](V) bool) range func(yield func[K, V any](K, V) bool) Once you demystify the yield function and how it works with the loop, it starts to make more sense. That said, i agree with you. It's definitely not intuitive, and i get the feeling it's going to be one of the ugliest parts of Go until something better comes along. Channels are one of the easiest things to use and understand despite their inherent complexity, so to see something like this make it into the language as a standard feature is quite sad.
Why don't we embed interface into structures? For example, If you intend to make a structure implement an interface, simply add "implement interface_name" in structure definition. That will add clarity in code. Right?
It's impressive, closer in performance to something like Vi/m, Kakoune, Helix than VSCode. I still prefer Helix but for something more like a full IDE and all the AI, multicursor, modes, collab features it's great.
Lee Scott Jackson Karen Johnson Joseph
pray tell how you are making these videos they are awesome !
Are you interested in creating a Udemy course? to teach the go language, because you explained it very well with an interactive video
Congratulations on 10K subs sir. I'm happy I was here before this milestone 😊
Thank you very much! I appreciate that you are part of this journey!
Not sure where I read that Golang is a fool proof language, easy to learn for any noob.
@@epsigo never really changed, again if you don’t like a feature, just don’t use it. The day when Golang will become craps, it’s will be the day of the 2.0 update where old codes will just broke. Until them, there are nothing to worry.
Honestly dude, this explanation rocks! Thank you!
the sintaxis is ugly , i prefered it if it was a interface with a HasNext and Next methods or something like that
Yeah, the syntax is just mental :D Something like custom iterators in Rust is way more beautiful than in Go. But yeah, there were also a lot of discussions in the community; let's see where it goes.
The syntax is the way it is because of performance issues when using interfaces. This syntax allows you to use the functionality completely in the stack without needing to access the heap
@@flarebear5346 Also, I think it might be against the idiomatic practices of Golang. So, Go emphasizes simplicity and directness, avoiding more complex design patterns. But all in all, you will probably most likely won't use iterators that much :D
Function inside function inside another function... Little confused, hope will get it know.
The only problem for zed is it lacks of extensions.
I agree. But let's see what the community develops :)
Plugin plugin plugin 😂 vscode is useful when it has plugins otherwise, I can code in notepad as well 😂😂 Zed is good too but the plugin ecosystem is missing currently, hopefully it will grow soon and we can have same shortcuts and feature as vscode for our workspace ❤
Thank you very much!❤
You're welcome 😊
When creating your interfaces, all this is easy to understand. It's when you are using imports (even from the standard library), is when it gets hard. There is no clear way to tell (that I'm aware of) what interface a stuct implements without digging through the code finding what functions an interface implements, and then checking if the struct you want to use implements those same ones
It drives me nuts. Rust spoiled me :)
Zulauf Fords
On createUser we must assign a ID to the user struct type User should have another property of int ID And after creating a user the server should send the userId back to the client otherwise how would the client know the id for the GET users/{id}
This is too much editing for me
If you don't understand what is the purpose of it, believe me, you have used the same concept of sharing a lot before, I suggest reading article on Go Blog about the unique package and the wikipedia about interning
Instead of storing 1000x of "example", what handles does is that they save 1x "example" in interning way and other 999x handles are references to it, am I getting it right?
Yes, that's correct! Essentially, there is one canonical copy of "example" and 1000 handles that reference this canonical copy.
Nice video, I wonder what happen with more complex structs or with pointers
Thank you :) It will definitely improve the performance with more complex structs!
can you please create a video on you developer workflow? Editor config etc
Sure, it's in the pipeline :)
@@FloWoelki awesome. Recently found your channel, already loving the content. ❤️
@@ayushtripathi4514 Much appreciated, thank you! :)
I really wonder what people mean by "slow editor". Never, like not even once, peeked into a situation where code was appearing slower than I typed or I dunna, waits more than a few seconds - like 2 or 3. Problem seems a bit like made up by the developers of Zed ;) I mean even JetBrains is not that slow, and when it is, you just reload it. But exchanging top notch static analysis and code intelligence for one second of saved time - like, whyyyyy? :) It's a bit like going with a bike around the world and saying it allows you to save on fuel. Well, yeah, it does. But... :))))
You are not comparing the same thing. You basically create two ints and compare them, which is certainly faster. Move hash creation to inside the loop, them it will be a more fair comparison. Make hash is useful if the comparison happens multiple times.
Yes but no. It’s not comparing the same thing cause that’s the point. My understanding is: You’d create the „unique handle“ once at some point in advance to prepare for many expected (in this example) comparisons.
What does second call to read memory actually show ? shouldn't handled be garbage collected at that point?
What is ur used font ? 🎉🎉🎉
It's the Monaspace font :)
you can replace `for _ = range 10` with `for range 10`
Fair point :D Thanks for the suggestion!
Good video. Incidentally, in benchmarks written in Go 1.22+, you can replace for i := 0; i < b.N; i++ by for range b.N
Jap you are correct, thanks for the suggestion :D
I wonder what happens when you just do one comparison without a loop, that time unique should ideally take more time because it is maintaining other things about the vars you have declared and also it might have to compute a hash of some sort on each var which might add a little more time, but I am unsure though, I will definitely give it a try. Really nice video.
I noticed you write loops the same way i do which is forgetting that there is a range keyword 😂
I am kind of used to it in case I need `i` sometimes later :D but yeah, there is a neater way of writing this for loop.
Garbage video.
Thank you!
Glad you liked it :)
Thank you!