⏲️ ⚡️ That feeling when your timer returns the wrong time & new 🌩️ lightning round! - podcast episode cover

⏲️ ⚡️ That feeling when your timer returns the wrong time & new 🌩️ lightning round!

Jul 12, 202421 minEp. 71
--:--
--:--
Listen in podcast apps:
Metacast
Spotify
Youtube
RSS

Episode description

★ Support this podcast on Patreon ★

Transcript

Jonathan HallJonathan Hall

This show is sponsored by you, and it could be co hosted by you. Stick around till after the news to hear about how you could join us as a possible co host. This is Cup of Go for July 12, 2024. Keep up to date with the important happenings in the Go community in about 50 minutes per week. I'm Jonathan Hall.

Shay NehmadShay Nehmad

And I'm Shaquille O'Neal. I'm Shay Nehmad

Jonathan HallJonathan Hall

Man. You're so tall, Shaquille.

Shay NehmadShay Nehmad

No. I'm actually I think I most like him because of his, sharp business acumen.

Jonathan HallJonathan Hall

Yeah. Yeah.

Shay NehmadShay Nehmad

Yeah. How has your Friday been so far?

Jonathan HallJonathan Hall

I'm on my second cup of coffee. It's almost empty. So 3 is coming up soon.

Shay NehmadShay Nehmad

Hey, but the drawing on it is still nice.

Jonathan HallJonathan Hall

The drawing on it is still cute and and brew brewstery.

Shay NehmadShay Nehmad

So we have a bit of a different episode. Usually, we talk a lot about, like, proposals and things that are going on. There's one honorable mention of of proposal I would like to talk about which is my proposal, of course.

Jonathan HallJonathan Hall

Which hasn't been closed.

Shay NehmadShay Nehmad

It hasn't been closed yet. But as you may know, go, 1 to 3, is in freeze. So there's no proposal meetings for a while. While you're waiting, it's a good time to, instead of writing proposals, write some papers for call for papers. We wanted to, mention 3 conferences.

A, we talked about the last week, but there's the Go Israel conference coming up in September. I think you have, like, 2 days before the call for papers out. We have, FineCon 2024, also in September in Berlin, Germany. Fine, f y n e, is if you've been listening for the show for a while, you probably know open source project led by a dear friend of the show, Andy, which is all about GUI development.

Jonathan HallJonathan Hall

Yeah.

Shay NehmadShay Nehmad

Not GUI in the sense that all the core is, you know, GUI and vulnerable because it's a spaghetti code. Mhmm. But GUI, like user interfaces. Since, we've talked with, Andy, I've I've tried a find a few times and it's fun.

Jonathan HallJonathan Hall

I I have a project in mind I intend to use it for. So I I hope to to learn that it's fun as well.

Shay NehmadShay Nehmad

How about you, tell everybody about it by handing in your call for paper? It's, you have until August 16. And if you're in Germany in September, FineCons are gonna be there. I don't know if it's FineCon, maybe just FineCon. And there's also, GopherCon Singapore 2024. The date is not closed yet. On, paper call, it says November 1st. On their side, it says, end of October. But you know how we are programmers with dates. Maybe they should set a timer.

Jonathan HallJonathan Hall

Foreshadowing. That's called foreshadowing.

Shay NehmadShay Nehmad

I have to admit, again, like, gopher logo on their side, top tier. It's like a whale, a salmon gopher with a white hair carrying a bunch of other colorful gophers on its back. Rene French, you're outdoing yourself. So they're currently soliciting talk proposals until August, until the middle of August as well. If you are in Singapore towards the end of, October, you should probably hand in something.

Like always, I think working on handing in a CFP is really important even if you're not handing in, a specific one. Right? Just a way to, like, work on go, engage with the community, give back. It's a really really good idea. So if you're listening like, yeah, I should probably get on that. The rest of, like, 12 minutes you have for listening to the show, I'm looking at the backlog right now. You can skip it and go work on your papers. Nothing's critical. But let's talk about, the 123 freeze.

Jonathan HallJonathan Hall

Yeah. Let's do it.

Shay NehmadShay Nehmad

What's going on there?

Jonathan HallJonathan Hall

You already mentioned there's no, no proposals for

Shay NehmadShay Nehmad

a while.

Jonathan HallJonathan Hall

There have been holidays, July 4 or last, couple weeks ago, whatever, a few different things. But nothing is in Italy. What? Sorry?

Shay NehmadShay Nehmad

Is aren't some of the go team in in Britain?

Jonathan HallJonathan Hall

Probably. We kind of scattered around, but their HQ, I think, is in, is in, the US.

Shay NehmadShay Nehmad

Yeah. That makes sense.

Jonathan HallJonathan Hall

So, you know, half your team's gone, it's hard to have a meeting.

Shay NehmadShay Nehmad

Or it's easier. Depends on Or easier. Depends on your personality type, I guess.

Jonathan HallJonathan Hall

The rebels are gone. Now we could have a real meeting.

Shay NehmadShay Nehmad

Oh, jolly good, fellas. Alright. Let's rename color to Calure all over the world.

Jonathan HallJonathan Hall

So, anyway, on the on the topic of the 123 freeze, the release notes are looking pretty good. I don't I'm sure they're not finalized yet. I actually spotted a couple typos, but they're for the most part flushed out. Last week, it was just a bunch of boiler plate that said fill this in with blanks. Those blanks are mostly gone.

So if you wanna know what's gonna be a 123, we talked about a lot of the stuff already in the show. You know, the new Range Rover Funk, we've we've talked about even a 122, because it's available there as an experiment. Telemetry, a whole bunch of things. We're not gonna go into all the details here since a lot of people will be repeating ourselves. But you can go check that out.

Link is in the show notes. The one thing we are gonna talk about today is some changes to the timer, which have been a little bit controversial, and we have a a great blog post we wanna talk about, on that topic.

Shay NehmadShay Nehmad

Yeah. So there's when you look at the blog posts and the thing we the things we mentioned, my biggest test for quality of a blog post is how fast I'm sending it in, company Slack or, like, sending it in, in some channels. This one was, like, finished reading immediate send. Uh-huh. So it's by Anton Zhyanov.

Jonathan HallJonathan Hall

How often do you send a blog post before you finish reading it?

Shay NehmadShay Nehmad

I really try not to do that, but Yeah.

Jonathan HallJonathan Hall

Because then you regret it later and like, oh, crap. It was actually a bad blog post.

Shay NehmadShay Nehmad

Yeah. But if you're like, timers are not, super ubiquitous features. Some of the people, listening might have not even heard of it. What are timers? Like, why would I use them?

Jonathan HallJonathan Hall

So I mean, we we all know about time in Go, and sometimes you wanna do something at a future date or maybe every 10 seconds or something like that. So there's this type in the center libraries called just called the timer, and it basically triggers an event, sent to a channel after

Shay NehmadShay Nehmad

a set delay. So a common use case for timers would be, like, I'm selecting on a channel, I want to do stuff, but I want to be able to get cancelled. Right? So I'm getting in a context as well. But I also just wanna make sure that after a time out, maybe I exit as well or even just log something and say like, hey, I've been waiting for 5 minutes and nothing happened.

So Mhmm. You could imagine how write a for loop and then inside the for loop you maintain a counter and, like, you count how many seconds passed since the last time you logged the message or something like some manual, implementation like that. But obviously, Go has a superior channely Go looking thing that looks really, really nice. You just like read from time dot after a specific time out. And you just pass it to it like time dot minute.

And then in that channel, after a minute, something's gonna get sent. And I have to say I was sure this is just some run time magic or something. I never thought about it. Mhmm. But this blog post really illuminated something for me, where you look at the first, code example, and it taught me 2 things.

First one is get alloc, where you can see how much memory you have. I didn't know about that. Super cool. And the example basically opens, like, a 100 timers and then exits. You don't nobody's listening to these timers anymore.

Mhmm. And the hook of the blog post is that behind the scenes, you've created timers and they are not freed until they expire. Even though nobody's there's no code path that's listening to them anymore. And my mind was like because that makes a lot of sense, but I was really surprised to not think about it before. So what's the incorrect solution? Which is I really love how, you know, someone shows the the first obvious solution first, which is obviously wrong.

Jonathan HallJonathan Hall

So the the, the incorrect solution, which ironically is suggested by the book 100, Go Mistakes and how to avoid them, which we've talked about on the show previously.

Shay NehmadShay Nehmad

And I I recommend all the time to people.

Jonathan HallJonathan Hall

Yeah. It's a great book. It is a great book. But even great books sometimes make mistakes. Right? Or or give a suboptimal solution. So the solution presented in that book is to reset the same timer rather than reusing rather than creating a new timer for each of these 100 instances, you can, reuse the same timer. However, this is not the correct way to use the the reset method on on a timer as the blog post illuminates.

Shay NehmadShay Nehmad

Yeah. Because reset does reset the timer, but if the timer already sends something on the channel, you're not gonna get what you expect. My thought is, oh, I reset the timer, so now the channel's empty. But in reality, when you call reset and you listen to the channel, you might get a previous, like, trigger of the of the timer. There's a 123, fix here.

The timer channel associated with, you know, quoting directly from 123 documentation, the timer channel is unbuffered, with capacity 0, which means that for any call of reset or stop, there's no stale values in the channel. And this blog post really feels like a a a rollercoaster because, like, okay, they made the channel size 0, there's nothing buffered, and and then, you read and it's like, oh, but actually in the code But wait, there's more. Yeah. The channel is size 1, but they somehow hacked that specific channel to be 0. Really really good blog post, for a few reasons.

One, relevant to the current release. Explains line that I wouldn't understand from the release notes really, really well. 2nd, a ton of runnable examples. Like, almost everything on the site here, you can click run. And I looked into it.

This is also, by the same, person. They developed this interactive code examples, thing because they believe that most technical writing benefits from code examples, and I very much agree with them. So this is really cool. It's super cool. It's called Codapi, I think.

It's and, you know, it's open source. I think they have a cloud service option as well. But it's it's open source and I really wanted to support it as well because it really helped me understand what's going on in the blog post, which is fairly technical. It's not like an easy I wouldn't read it on a phone. You know what I mean?

Jonathan HallJonathan Hall

You can pick out just the bits you you need. Like, if you just wanna jump straight to the the solution, you can. But if you wanna understand the whys and the the WTS, yeah, read the whole thing. It's a fascinating read.

Shay NehmadShay Nehmad

The it's like in school. Right? It's not just a solution. It's the it's the way. It shows your work.

Jonathan HallJonathan Hall

It shows the work. Yeah.

Shay NehmadShay Nehmad

Show your work. Exactly. So Anton, super cool, blog and super cool blog post. It was an immediate send in our, work Slack, and it was interesting. I it's a small enough bug that, I would be like, cool, And not just, get worried as well. It's just like, Interesting.

Jonathan HallJonathan Hall

I do have to agree with the author that it feels like an ugly hack. And and and other comments I've read elsewhere on the interwebs that the the source could literally says it's a buffer channel of size 1, but then there's a special case in the compiler that that treats it as 0. It's a super ugly hack, but it works. So I don't know. What can you say?

Shay NehmadShay Nehmad

So it doesn't look great, but if you read the commit message, it is super well justified. The commit message for this change is almost as long as the blog post. And it goes through, oh, way back in 2015, blah blah blah. There's a go debug flag called async timer chan, blah blah blah. And the the main thing to pick out from the commit message is after the 2, year window where, you know, Go will have like 4 versions and doesn't have that backward compatibility promise anymore, they could drop support for this flag and then add the specific, like, fix this to make it look normal instead of this kind of weird, hack.

Because you don't wanna, they didn't wanna break programs, you know, that poll when the timer has triggered already, blah blah blah. And don't compile with that flag. I think I think it's justified. And, you know, we can put hey, Siri, put a reminder for 2 years from now to check what happened with that async timer chan code. Just another to do on the pile.

Right? But I don't know. It's fun to see the things you have to do to get this backward compatibility promise, maintained. Sometimes you have to just, you know, put out some not great code to do make that happen.

Jonathan HallJonathan Hall

I do. Alright. So we're gonna try something new on the show. Is ishaya sort of alluded to at the top of the program. We're gonna do a lightning round. We're gonna go through some we we have more stuff than we can cram into 15 minutes. We're already past 15 minutes, so we're gonna just quickly, we think, we hope, fingers crossed, touch on some interesting topics that we wanna cover quickly. So, like, 10, 15 seconds each is is kind of the goal. We'll see how we do.

Shay NehmadShay Nehmad

Lightning round. So first up, Filippo, friend of the show, has opened, another window or another door for people who want to maintain open source and, you know, live from it. We interviewed him in the past, so you can find that episode. And he opened Geomis, which is a sustainable open source maintenance firm. He's joined by the, 2 associate maintainers, a title I love.

Another person was working on a crypto in Go, and someone was working on static check-in Go trace UI. And, GeoMIS is, on its way. I don't know if they're accepting, CVs, but now is your

Jonathan HallJonathan Hall

time to try. Next up, a new project called Open Hugo. I love it because, we have so many Hugos now. We have Hugo and we have Hugo. We've had both we've had the the author of Hugo with a t on recently on the show. Open Hugo, though, is, a library to talk to your Philips Hue smart lights in Go. It's auto generated using open API cogen, which we've had the author of that on our show too. So this just has so many ties into our show. And, I have smart lights. Do you have smart lights?

Shay NehmadShay Nehmad

No. I'm not like, what we talked about. I'm not really a smart guy, so that wouldn't fit.

Jonathan HallJonathan Hall

Well, you could be smart or you could be nice. So, you

Shay NehmadShay Nehmad

know, there's, it's, nice to be important, but it's more important to be nice. In any case, if you want to control your Philips smart lights from a go script, now you can

Jonathan HallJonathan Hall

do so. And that's h u e go, not h o g o or h u g o or whatever. So many ways to spell Hugo. I love that there's so many projects with the same pronunciation and all these gopods. Oh, we

Shay NehmadShay Nehmad

need to find another one.

Jonathan HallJonathan Hall

We need to find another one. We're gonna rename the show also to Hugo.

Shay NehmadShay Nehmad

Another cool open source project by one of our beautiful Patreon supporters. Thank you, Fredrik Averpil. We appreciate your support. And we appreciate your new sort of plugin for Neovim. Do you use Neovim?

Jonathan HallJonathan Hall

I I'm one of those guys who has to look up how to exit Vim every time I accidentally find myself in that trap.

Shay NehmadShay Nehmad

So I had a a rough history with Neovim. Last startup, we really tried to make it work and work on the setup and whatever. We wrote a lot of Go and eventually I caved and just used the Versus Code with the Vim motions. And I've been like, I don't wanna mess around with dot files since then. But if it's that time of year and you're like, okay, I'm clearing out my dot files and I really wanna do the neovim thing now.

Frederick has supplied you with a reliable Neotest adapter for running Go tests in Neovim, and it looks great. It really really does look super cool. They have like a tree test explorer thing, which I think is the best view to look at these sorts of things. I think it looks good enough to the point where I would write more tests because the tool is delightful. It just looks really good.

And from what I've slightly tried, it also works. So I guess, 2 things, 2 points there. Thanks a lot, Frederick, for your support, but also for the cool plugin.

Jonathan HallJonathan Hall

Next up in the lightning round, we have a new library. Actually, is it new? Yeah. New ish, called GuiU, g I u. It's a graphical user interface, framework for Go, with bindings to the I'm GUI project, which is the c plus plus GUI library.

So if you're looking for an alternative to find, I think this would be something you might look at. It's a version 0.8. 1 as of 4 days ago, so it's still, in apparently early development, but it's based on a a solid, c plus plus library. So probably a little bit less cross platform than find, which runs even in web assembly in your browser as far as I understand. But it's an alternative to look at if you're building or wanting to build GUI apps in Go. Link in the description.

Shay NehmadShay Nehmad

I think it it's a good candidate if you wanna go to fine con but you don't know what to talk about. This could be a good, conversation crutch. Right? Wait. But how is fine compared to GIU? And everybody's, like, has their opinion. Finally, on the lightning round, Ergo chat, which is an IRC server, also known as Oregano. It's an IRC server. If you're a time traveler, you're here from the eighties. First of all, I'm sorry.

There's a lot to catch you up on, but you can still use IRC. And 2 weeks ago, they released new stable release with a ton of bug fixes, new authentication mechanisms for integrating with web clients, and just a whole lot of features. Or if you are into IRC chatting, I wish I was cool enough to be that, that guy, there's a new release, that's come out. And that does it for our lightning round. Ding ding ding.

Jonathan HallJonathan Hall

Shai, what you really need is an IRC bot that lets you control your Philips Hue lights from IRC.

Shay NehmadShay Nehmad

That's, and, you know, a GUI app on your phone written in fine to to do all. There you go. There you go. Goify all the things.

Jonathan HallJonathan Hall

I think that wraps it up for the show.

Shay NehmadShay Nehmad

Yeah. Let's move on to our ad break.

Jonathan HallJonathan Hall

Yeah. Let's move on.

Shay NehmadShay Nehmad

Alright. We're after the lightning round. Everybody can relax. So first up, we want to take a break at the end of August. So we want you to come cohost, August 23rd and August 30th. If you want to, be a Capo Go host and and tell people about the news and and share your opinion, etcetera etcetera, just talk to us on Slack. How might you do that? This could be your intro into podcasting. Yeah? How might you reach out?

So you can find us on kapago.dev, on go for Slack, hashtag kapago, kabobcase with hyphens, or via email with news at capago.dev. That is news atcapago.dev. Other ways to support the show, including joining our Patreon. Thank you to all our beautiful Patreon supporters who indicate that this show can be a sustainable hobby. It is a hobby.

We do it for ourselves to learn about Go and and stay sharp and have some fun, but it is an expensive hobby. Patreon is basically the only way that, makes this sustainable, or I guess I should say on its way

Jonathan HallJonathan Hall

to making it sustainable. Less unsustainable.

Shay NehmadShay Nehmad

Yeah. A lot more sustainable. If you wanna support in other ways, you can buy some swag and also share the show. We don't pay to advertise. All people who are here are because someone told them about the show or they found it.

So sharing the show at your workplace, with your university, in some online forums, or leaving a review on the app where you listen to, the show, like Spotify or Apple Podcasts or Podcast Addict or whatever really helps us, get to more people which is just fun. More people talk to us, we get more ideas. For example, the neo neo Vim thing wouldn't have come on our radar because none of us ride in neo Vim, but I thought it was a super cool project. And it's just because Frederick, one of our patrons, shared it on the Slack channel. So there are myriad ways to support the show, and we're happy to have all of you here, for it.

Especially our patrons, and we wanna shout out a couple of you.

Jonathan HallJonathan Hall

A big shout out to Christian Van Kietzel. I think I said that right. And Jamie Tanna, who actually had on the show as a a guest as well.

Shay NehmadShay Nehmad

And was even helping out at Orca this week.

Jonathan HallJonathan Hall

Oh, wow.

Shay NehmadShay Nehmad

He came he came to talk with my team. Like, we work in similar things. I do, develop productivity. He does developer productivity. So he came and talked to us. Super cool. Thanks, Jamie. And thanks, Christian. Even if you didn't come to talk, with my team at work. Yep.

Jonathan HallJonathan Hall

So I think the big question on everybody's mind right now, Shai, is are we gonna open an IRC channel using Ergo?

Shay NehmadShay Nehmad

Oof. Actually, that could be I was like, oh, that's a good joke. But actually, that could be cool. We might. We might. You know what? I'm adding it to the list of meta tasks we have, which includes the proposal we opened. Right? So so I'm actually putting it there. IRC, using Ergo. I'll try it.

Jonathan HallJonathan Hall

Alright. Well, maybe we'll see you on IRC later on.

Shay NehmadShay Nehmad

See you on IRC. Bye, everybody.

Transcript source: Provided by creator in RSS feed: download file
For the best experience, listen in Metacast app for iOS or Android
Open in Metacast