Cup o' Go

Creators & Guests

Host
Jonathan Hall
Freelance Gopher, Continuous Delivery consultant, and host of the Boldly Go YouTube channel.
Host
Shay Nehmad
Engineering Enablement Architect @ Orca
Editor
Filippo Valvassori Bolgè
Sound Designer / Audio Editor based in Milan

What is Cup o' Go?

Stay up to date with the Go community in about 15 minutes per week

Shay Nehmad:

This show is supported by you via Patreon. Stick around to the ad break to hear more and perhaps join as a member. This is Cup o' Go for March 29, 2024. Keep up to date with the important happenings in the Go community in about 15 minutes per week. I'm Shay Nehmad and I approve this message.

Shay Nehmad:

I need to somehow rerecord it for every single date just in one sitting.

Jonathan hall:

There you go.

Shay Nehmad:

Stop saying that. And who are you?

Jonathan hall:

I'm Jonathan Hall.

Shay Nehmad:

And you don't approve this message. That's what

Jonathan hall:

you're saying. I don't disapprove it.

Shay Nehmad:

How are you, Jonathan?

Jonathan hall:

I'm okay. How are you?

Shay Nehmad:

I am tired because daylight saving time. Yeah. We talked about time 2 weeks ago, right, because of the proposal for UNIX time. And then we talked about it last week because of my proposal for, you know, like pretty string formatting that got rejected. And I wanna talk about time today again.

Shay Nehmad:

Why in god's name do we still have daylight saving time?

Jonathan hall:

Programmers talk a lot about DST bugs. They're saying it wrong. DST is the bug.

Shay Nehmad:

We had an, the recording lineup for 10 AM my time today, but Israel just moved to daylight saving time overnight. So, a, I'm tired, b, we delayed it in 1 hour and my whole schedule got messed up. And I just bet, like, if the, I don't know, the shadow council lizard people of the world are somehow listening to our show, please cancel Daylight Saving Time. Please. And bring back Elvis.

Shay Nehmad:

Alright. Let's talk about some Go proposals.

Jonathan hall:

Let's talk about something we talked about before. Let's talk about something we talked about before. Let's talk about something we talked about before. Nice. So, we talked a few weeks ago about slices dot repeat proposal.

Jonathan hall:

It has been accepted and then re accepted, which is just perfect for a issue about repeat. Basically, they accepted the proposal to add a function called repeat that takes a type parameter of any and then, a slice of that as an argument and account to repeat that so many times. After they implemented it, Ian Lance Tanner comes back says, sorry for not noticing this before, but every single, function in our slices back, it has a different type parameter, takes 2 type parameters. We should match that. So they reimplemented it, or or will be reimplementing it at least to match the same type parameter parameters as all the other functions in that package.

Jonathan hall:

So not really a huge news update, but it's it's just worth repeating. It's worth repeating.

Shay Nehmad:

I'm wondering how, like, throughout such a intensive proposal process, you can miss something like that?

Jonathan hall:

It is funny. Like, there was a lot of bike shedding. That's what was the what we talked about last time. Right? There's a lot of bike shedding on here.

Jonathan hall:

It's like, what color should the bike shed be? Let's talk about this for 3 weeks. Okay. Final set it on green. Oh, wait a minute.

Jonathan hall:

All the other bike sheds are blue. Let's go back to blue.

Shay Nehmad:

Actually, all all our employees come in by car anyway. So this is a bit of a tangent. I went on, that's it's so unrelated, we might even cut it out. But I went to a meetup, this week, and the meetup was, at Wix's new campus in Israel, which is a huge building. And I got to the 1st bike shed, literally put my bike there because I I rode my bicycle to the meet up.

Shay Nehmad:

Got in. No. This is the wrong entrance. And I was like, okay. Can I take my bike somewhere else?

Shay Nehmad:

And she's like, yeah. There there's a bike shed there as well. So I'm like, alright. I have to untie the bike, and, you know, it's already the meetup is starting, and my entire team is I'm fighting. Then I'm putting my bike in the thing, and then the guard starts arguing with me about going into the vi can I tie it here?

Shay Nehmad:

Can I not tie it here? Can I tie it to the bench instead? I wanna tie it up. I don't want people to steal it. So I was actually bike shedding for a while, and then the meetup started.

Shay Nehmad:

VP R and D of Wix, like, VP Engineering of Wix, like, start selling about their new platform and how they wanted people to stop bike shedding. And all I can think about is my last 15 minutes arguing people, oh, can I put my bike here? Can I go through here, please? Nice. Bike shedding about bike shedding.

Jonathan hall:

If you like little bike shedding, Amsterdam is the city for you, by the way.

Shay Nehmad:

Totally. So we have another proposal we wanna talk about, that got accepted, and it's actually in the implementation phases right now. I think it's a good time to jump in. One of the things I really like about Go is how much of the tooling is built in. Right?

Shay Nehmad:

You don't have to worry, for example, about formatting. There there's no bike shedding about formatting, for example, In go. And one of the good tools for that is GoVet. Right? Built into the language, sort of a best practices linter, I would say.

Shay Nehmad:

Right? So for now, you know, vet has a bunch of checks, and there's always this tension, what other checks should we add to vet? And this proposal that got accepted will add reporting of 2 new standard library symbols in your code, which is super interesting. Like if you use a thing that is too new for the, go version that your model is in, for example, let's say range over int, right? You try to use range over int, but your model is go 120, because you have to stay compatible to go 120, go vet will report it for you, which is a lot easier, faster, and and and a much better developer experience than finding that out, like in compilation or even in like linking or in run time or whatever, like later.

Shay Nehmad:

So it's all about finding these things earlier, like you evaluate the build constraints in, you know, in the go files, in the in the go mod file. And by looking at those build constraints, you find, things that you're trying to use in go that are too new. This got accepted about 2 weeks ago and the issue now tracks, the implementation. And you can jump to the, you know, different change, like, pull requests. I don't know how they're called in.

Shay Nehmad:

Garrett, do you do you have any idea?

Jonathan hall:

They're called, CL. Change change list maybe? Is that what it is?

Shay Nehmad:

Yeah. Anyway, the weird interface that Go, uses, I just use GitHub for so long. So there's a few issues where you can a few change lists where you can take a look at people sort of starting to implement that and and mentioning this issue, which is interesting. And I think there are a few other places people might want help. And this is a really easy thing to pick up, I think.

Shay Nehmad:

Right? Just look at some stuff and and try to implement this, better. So if you've been itching for an opportunity to get your hands dirty in the Go open source code, think this is a really friendly, easy, and you know, with some people we know like Daniel Marti and some other people who are, you know, pretty good contributors like, Jay Conrad and people who've been around. Brian Mills, she talked about last week. So that proposal got accepted.

Shay Nehmad:

Right now in implementation, hopefully, GoVet will report this stuff for you soon. If your entire code base is the same version, I don't see it being an issue. Right? It's mostly if you're, like, maintaining multiple modules in multiple versions.

Jonathan hall:

It's gonna mostly be an issue for libraries probably. And and one of the comments in the issue from 3 weeks ago does a a short audit of some popular, libraries where the the Go mod is declared as one version, but then they pull in features from the standard library for a much later version. So you know, for example, you may recall that IO dot readall was added in Go 116 which replaced IOutil dot readall which had been around forever. And so there's one particular library that has a Go mod set to go 1.12, so it claims to be buildable on Go 1.12, but it uses io.readall which means it will actually fail to compile between Go 1 point 12 through 1.15. So this would would catch that sort of thing.

Shay Nehmad:

Cool. So if you have a library, I guess it would be useful. Again, what I'm imagining is that in a big enough corporation, like internal source code, you would start having, different Go versions, but that only applies when you're, like, hundreds of developers. If you're below a 100 people, you're probably all on the same go version just because it's so easier. Cool.

Shay Nehmad:

Let's talk about context. This is a really good blog post I wanna I wanna hear about.

Jonathan hall:

So we all know context. We all love context. Context is great.

Shay Nehmad:

Just a bag of things you should put everything in. Right?

Jonathan hall:

Exactly. That's exactly what it's for. It allows you to bypass type safety and compile time checks and all those nasty things that get in the way when you're trying to be productive as a developer.

Shay Nehmad:

There's no way for you to see our faces. I'll just, out loud, say, like, slash sarcasm or end. This is not the official position of the podcast. Don't put everything in the comment.

Jonathan hall:

In fact, I try to avoid using context for values. I use it I try to use it exclusively for cancellation signals, but there are times when I use it for values. And that's what this blog post is about. Basically points out a couple of, potential sort of foot guns with context. Specifically because what would you call context with value, for example, it wraps the existing context and returns a new one that wraps the old one.

Jonathan hall:

If you do this on a for loop and you don't declare a new context every time, you end up just adding new values over and over again to the same context. Or you're wrapping it, rewrapping it, rewrapping it, rewrapping it, which can use a lot of memory and and be silly slow and so on.

Shay Nehmad:

Why is that the official behavior, do you think?

Jonathan hall:

Why does it wrap rather than, like, modify? Yeah. Is that the question? Oh, because for immutability? Immutability.

Jonathan hall:

Yeah. Yeah. It is useful when you're not using a for loop. It's really nice to be able to have one context that you could, like, call 6 goroutines and pass the same context to the 6 goroutines. And those 6 goroutines could each add their own thing to the context depending on what's going on.

Shay Nehmad:

In their own, like, copy And you're not worried about, like, concurrency issues. Exactly. Exactly. That makes a lot of sense.

Jonathan hall:

Yeah. So if you use a lot of context in particular with value, have a quick look at this blog post. Really well written.

Shay Nehmad:

Yeah. It's Gap notes. Shout out to you.

Jonathan hall:

It's real short, and it might save you some memory leaks or other problems.

Shay Nehmad:

Yeah. Gabriel Go and Python software developer at OVH Cloud from France. Really cool blog. I really like these sort of very minimal, high value, and, you know, been going on for a while blog posts. He started it in 2020.

Shay Nehmad:

Dude, keep it up. You have a lot of great content. We love it. Cool. One thing you said, you know, multiple Goroutines.

Shay Nehmad:

Didn't you mean, multiple threads?

Jonathan hall:

Yeah. No. Well, we don't we don't believe in threads in Go in any context.

Shay Nehmad:

In any context. That's fine. So, this is a really news about the Go community, not about Go. And it's not really news. It's just a bit of drama that I found funny.

Shay Nehmad:

So over on the go for Slack, if you haven't joined, we recommend it, especially our little community, hashtag cupago, cup dashodashgo. So there's this quote from, Douglas Adams. Right? In the beginning, Bill Kennedy offered to reuse threads. This has made a lot of people very angry and was widely regarded as a bad move.

Shay Nehmad:

So it's just amazing how much people care about this stuff, I guess. Like Yeah. Use threads, don't use threads, who cares? The discussion over on the Slack channel is very lively, And it's been all over from, if we don't use threads, I'm not gonna use the Slack anymore, to let's get all the languages together and do a migration to Zulip, and everybody will have to move. And, if you have an opinion about that, if if you really like or really dislike, how we're doing, threads in our Slack channel, you can join.

Shay Nehmad:

There's an open discussion. It's threads discussion, and we'll put the link in the show notes.

Jonathan hall:

One alternative if you really don't like the way threads are or aren't handled on the gopherslack, you could switch over to using go dev.com. Go dev.com is a new website that just was announced a few weeks ago. It is essentially Stack Overflow, but just for go, godev.com. The interesting thing about this website is it is powered by Apache Answer, which is written in Go. We talked about that project a few weeks ago.

Jonathan hall:

So they, they handle threading in an entirely different way, so you don't have to worry about that whole debate. Yeah.

Shay Nehmad:

So it's funny. Apache answer is written mostly in Go, and now you have godev.com, which is Stack Overflow just for Go. I don't know who will use that. I'm exclusively asking either, the official documentation if I really care about something or, you know, get up CLI, like, get up, copilot chat directly in my ID. Basically, I'm only going to Google to search for answers or Stack Overflow when I'm stuck, like, when these two options don't work.

Shay Nehmad:

But you gotta have these answers somewhere to, like, keep the language alive.

Jonathan hall:

One really cool thing about this, is that it has the Go Playground built in. So you can put Go snippets and you can execute them in your browser, which is something Stack Overflow has, I think, for a few languages like JavaScript maybe, but I don't have that for Go. So that that's one benefit to using this is you can execute your code examples in your browser. I'm not sure that that's enough to overcome the the critical mass problem, but it is a nice feature.

Shay Nehmad:

There's questions here that wouldn't live on, Stack Overflow as well. For example, continuous profiling question mark asked by, Levi Lewis. Beyond preprof, what tools are you using to profile production workloads? Now I've been working on this, in ORCA, like, as part of my work, super heavily. We're we're really into introducing pyroscope and continuous profiling right now.

Shay Nehmad:

Of course, because most of our code is Python, and Python sucks, and it's very slow. And, this is a thread that, you know, if you asked, on Stack Overflow, you would get absolutely shredded. Oh, yeah. Right? Because the all the stack overflow mods would be like, what are you doing?

Shay Nehmad:

This is not a specific question. This is not a place for accommodation. Blah blah blah. And here it seems a lot more calm and open. So I guess it's it's a good alternative for slightly more open ended discussions.

Shay Nehmad:

Definitely. One

Jonathan hall:

of one of the high highest loaded questions is how do I get started learning Go? And I know I've seen that question closed and slammed shut about 15 times a day on Stack Overflow. So it's if that's the kind of question you wanna ask and answer, this is gonna be a good place to go.

Shay Nehmad:

Yeah. A 100%. And there are a few options here that, you know, the official Go tour, which we always recommend, and Ardan Labs is here and, you know, a 100% recommended from me as well at least. So it's interesting. Alright.

Shay Nehmad:

There's another story I wanna talk about, but I'm not sure if it's a story or a news item. How would you categorize that?

Jonathan hall:

Ranting?

Shay Nehmad:

Alright. I guess we need to open like a few categories, but how would we keep them in line? When I say ranting, maybe you say rant. You should probably map each one to a number.

Jonathan hall:

A number or some sort of constant string. There's a package

Shay Nehmad:

that could

Jonathan hall:

help with this.

Shay Nehmad:

Maybe an enumeration? But I've just read that Go enums still suck.

Jonathan hall:

Yeah. I I read that too.

Shay Nehmad:

Yeah. So there's this blog post, that really, really, really made the rounds. Mostly, I think, because it's, flame baby, but also because it's interesting. There's an original the original post is called go enums suck, which, you know, I can get behind. Like the iota thing, I don't like it.

Shay Nehmad:

It's not very useful. Every code generator I've seen, absolutely, it just moves to const and then does the map and the map. For example, when you compile protobuf, it doesn't do the iota thing. It does the let's do constants string

Jonathan hall:

Mhmm.

Shay Nehmad:

Thing. And then the blog post goes into, you know, why it's bad and how to do it. And then, you know, they wrote a tool called, go inums, which is fun. I wouldn't use it because if I got to that point, I would use open API or protobuf or something that's like super compatible, and this is a follow-up blog post. So like behind the flashy colors and the very, rage baity titles and whatever, I think this is very useful context and like, super interesting, you know, dive into this into the fact that the original option for doing it with Yoda is just weird.

Shay Nehmad:

But you didn't like it so much.

Jonathan hall:

So I I didn't like the original one that much either. I feel like it's kind of there's nothing new being said here. Although, I do appreciate the second one probably more than the first because my my TLDR of this is GoEnum still suck, but there's better solutions than what I came up with. That's sort of my TLDR. Because the original one had his own the author had written a library to to sort of help work around some of these problems.

Jonathan hall:

I felt like the library wasn't ideal, and now the author agrees and has some new suggestions. But, I feel like, in general, I agree. GoEnums suck. GoEnums don't really exist. So, yeah, they suck.

Shay Nehmad:

Mhmm.

Jonathan hall:

I feel like trying to come up with a general solution that isn't built into the language is just never gonna be the right solution. In some cases, there are useful alternatives, but you don't need a a full general purpose solution in most cases, which is what this author is trying to come up with.

Shay Nehmad:

I think there are just, like, competing requirements. Right? I want them to be backward compatible, for example, but I also want to be able to extend it. So Yeah. Either, you know, you go with, okay, I assign a number and I can never reuse that number, which IOTA doesn't promise.

Shay Nehmad:

Right? Because you can put a value in the middle. Alright. So you string values, but something has to guarantee that some some place else I know this this string values. So I have to extract them to somewhere readable.

Shay Nehmad:

I want forward compatibility. So what happens if I add a try to use a value that doesn't exist? Okay. So let's use 0 for unknown. And this is an example of even when you use a super strict schema language like protobuf, which I love, putting 0 as unknown is a lint, issue.

Shay Nehmad:

It's not enforced into the protocol. Right. So I totally agree. Like, you need to define whether your requirements from enums and then find the best solution. It is a problem though that when you look up how to do go enum before you figure out, oh, I need this specific type of extendable, with extra properties, string represented, but not backward compatible.

Shay Nehmad:

Like, you know, this matrix of things, the thing that pops up is iota, which is almost a 100% not what you want.

Jonathan hall:

Yeah. It's it's almost irrelevant to to the question. Almost.

Shay Nehmad:

Cool. Well, that's what we have for y'all, this week. We don't have an interview. So stick around for the ad break if you are really appreciative but we don't promise anything after that see

Jonathan hall:

you next week bye So I had to run quickly because of the time change, so I'm here alone for this short ad break. Thanks for listening. If this is your first time listening to the show, thanks for joining us. Would you do us a favor and share it with your friends and colleagues? Share it on your work Slack, share it on your work, Teams, wherever, with your with your colleagues.

Jonathan hall:

You're the gophers in your life. We're really excited to see this show growing in popularity and, we can't do it without you. If you are interested in helping support the show financially, we'd love to have you as a member on Patreon. You can go to cupago.dev, there you can find links to Patreon and all of our episodes and buy some swag that also helps to support the show. We're not making money off of this.

Jonathan hall:

We're just doing this as a hobby. But it there are costs involved, for editing, for hosting, etcetera. So we're looking for some financial help from the community if that sounds like something you'd like to do. And if not, of course, keep listening anyway. It is a free show after all.

Jonathan hall:

I also want to mention our growing community on Slack. We have a channel on the go for Slack, cup or go, that's kebab case. We have people joining virtually every week. We're at almost 350 people. We'll probably hit the 3.50 mark this week if the trend continues.

Jonathan hall:

Just this last week, for example, we had someone, Paul Boutot, I hope I say that right, joined. He said, hello. Great show. I thought I would join here too as the gopher Slack has mentioned so often. So apparently, long time listener, first time caller, if you will.

Jonathan hall:

Also says he's not really an experienced gopher. Great. We love to have inexperienced gophers. We love to have new people. The truth is there's always somebody more experienced than you.

Jonathan hall:

I mean, I'm I'm an experienced gopher in certain areas and completely inexperienced in others as are we all. So there's room for everybody in, in the channel over there. We talk about all sorts of stuff, not just the show and not just the news. Come join us. Be sure to leave a rating, review if you would, if you haven't done that already, wherever you listen to your podcast.

Jonathan hall:

That does help get the word out to the public about the show. I think that's about all I have to ramble at you about for now. I'm sure I forgot something. When Shai is back to help with this next week, we'll cover all of it. Thanks for listening, and we'll see you next week.