Skip to content
Go

Go 1.27 Draft: Native UUIDs, CutLast, and the Path to a Leaner Standard Library

Published: Duration: 6:30
0:00 0:00

Transcript

Host: Hey everyone, welcome back to Allur. I’m Alex Chan, and I am so glad you’re spending part of your day with us. Today, we’re diving into the world of Go—or Golang, for the SEO-minded among us. If you’ve been following the Go community lately, you know there’s been a bit of a "minimalist versus batteries-included" debate going on for years. The Go team has famously been very conservative about what gets into the standard library. Their motto has basically been: "If you need it, find a community package." Host: Joining me today is Marcus Thorne. Marcus is a Principal Engineer at CloudScale and a long-time contributor to the Go ecosystem. He’s spent a lot of time thinking about supply chain security and how we can make our binary sizes smaller without losing functionality. Marcus, it’s so great to have you on Allur! Guest: Thanks, Alex! It’s great to be here. I’ve been refreshing the Go dev blog every day waiting for this draft, so I’m pretty hyped to chat about it. Host: I can tell! So, Marcus, let’s jump right in. The headline for many people with Go 1.27 is this move toward a "batteries-included" philosophy. For years, the Go team told us to keep the standard library lean. What changed? Why are we suddenly seeing things like UUIDs being pulled into the core? Guest: Yeah, it’s a massive shift. I think the Go team realized that "minimalism" was starting to create its own set of problems. Specifically, what we call "dependency fatigue." You know, you start a new microservice, and before you’ve even written a line of business logic, your `go.mod` file is already twenty lines long because you need a UUID generator, a specific string parser, and some networking helpers. Host: Right, the "day zero" setup. Guest: Exactly. And every one of those dependencies is a potential security risk. We’ve seen supply-chain attacks where a tiny, single-purpose library gets compromised. By bringing these "primitives"—things that literally everyone uses—into the standard library, the Go team is saying, "We’ll take the responsibility for auditing and maintaining this." It makes the whole ecosystem more secure by default. Host: That makes so much sense. And speaking of things everyone uses... the `uuid` package. I feel like `google/uuid` has been in every project I’ve touched for the last five years. What’s the new native implementation bringing to the table? Guest: Oh man, finally, right? [laughs] The native `uuid` package is a big deal. It covers the basics like Version 4—which is the random ones we’re all used to—but the real star of the show in the 1.27 draft is support for Version 7. Host: Version 7? I’ll admit, I usually just hit "generate" and don’t think about the version. Why is V7 the "star"? Guest: It’s a game-changer for databases. So, standard V4 UUIDs are completely random. If you use them as a primary key in a database like Postgres or MySQL, the database has to do a lot of work to insert them because they’re not in any particular order. It wrecks your index performance. But V7 UUIDs are time-ordered. They’re lexicographically sortable. Host: Oh! So you get the uniqueness of a UUID but the "sort-friendliness" of an auto-incrementing ID? Guest: Precisely! It’s the best of both worlds. Having that native in Go means you don't have to go searching for a specialized V7 library. You just call `uuid.NewV7()`, and your database stays happy and fast. It shows that the Go team is really thinking about modern backend scale, not just "how do we generate a string." Host: That’s such an "aha" moment for me. It’s not just about convenience; it’s about performance in the storage layer. Now, moving from the "big" stuff to the "small" stuff that actually makes me really happy—`strings.CutLast`. I feel like I’ve written manual slicing code for file extensions a thousand times. Is this as simple as it sounds? Guest: [laughs] It really is. It’s one of those "quality of life" things. We got `strings.Cut` back in Go 1.18, which was great for splitting on the *first* instance of a comma or a colon. But how many times have you had a file path like `server.production.json` and you just wanted the `.json` part? Host: Every single day. And I’m always second-guessing if my index math is off-by-one. Guest: Exactly! You’d use `LastIndex`, then check if it’s -1, then slice from `i+1`... it’s error-prone. `CutLast` just handles it. You give it the separator, and it returns everything before the last match, everything after, and a boolean. It’s cleaner, it’s more readable, and it eliminates a whole class of "oops" bugs in string parsing. It’s a "paper cut" that’s finally being healed. Host: I love that. "Healing paper cuts." That should be the unofficial slogan for this release. Now, let’s get a bit more technical. The draft mentions improvements to the internal QUIC stack. For the folks who aren't networking nerds, why should the average dev care about QUIC in Go 1.27? Guest: So, QUIC is basically the foundation for HTTP/3. In previous versions, Go’s QUIC support was... let’s say, "in progress." If you wanted a really robust HTTP/3 server, you usually had to use a third-party library like `quic-go`. With 1.27, the internal stack is becoming much more mature. They’re adding better congestion control and better connection migration. Host: Connection migration... is that like when I switch from my home Wi-Fi to cellular while I’m on a call? Guest: Exactly! QUIC is designed to handle that gracefully without dropping the connection. By making this more robust in the standard library, Go is positioning itself as the premier language for "edge" computing and mobile backends. We’re getting closer to a world where you just turn on a flag in `net/http` and you get world-class HTTP/3 performance for free. Host: It really feels like Go is growing up. Like, it’s moving past its "rebellious minimalist" phase and into a "reliable professional" phase. Guest: That’s a great way to put it. It’s becoming more self-contained. You don't need a huge "shopping list" of libraries just to build a production-ready API anymore. Host: Marcus, this has been so enlightening. Before I let you go, if someone wants to start playing with these features today, what’s your advice? Guest: Well, it is still a draft! So, definitely don’t go refactoring your production billing system just yet. But you can download the beta or use the `gotip` tool to try it out. I’d recommend looking at your `go.mod` file, seeing which UUID or string-helper libraries you’re using, and try replacing them in a branch. See how much "cruft" you can actually prune away. It’s a very satisfying feeling. Host: I bet it is! Pruning the `go.mod` sounds like a very therapeutic weekend project for a developer. Marcus, thank you so much for joining us on Allur and breaking this down. Guest: My pleasure, Alex! Thanks for having me. Host: And thank you all for tuning in. This shift in Go 1.27 really highlights something we talk about a lot here—the evolution of a language isn’t just about adding features; it’s about listening to the community’s pain points. If you want to read the full draft notes for yourself, we’ll have the link in the show notes at allur-podcast.com.

Tags

Go Golang backend cloud-native uuid supply-chain standard library