text stringlengths 0 2.35k |
|---|
**Daniel Martí:** It essentially restricts how you can write and format code in a few extra ways. For example, no empty lines at the start of the function body. Things that I generally do. |
**Mat Ryer:** Cool. Okay, we'll put a link to that in the show notes, if anyone likes -- I like the fact we have `go fmt`, and I like the idea of a more strict one. Oh, Daniel, do you pinky-promise you're not gonna talk about those two other subjects today? |
**Daniel Martí:** Pinky-promise! |
**Mat Ryer:** \[04:03\] Okay, Daniel's pinky-promised. Okay. This is really professional. Okay, we've also -- you're not gonna believe this, Daniel... You will believe it; you already know. But imagine if you didn't... We've also got Michael Matloob with us. Hello, Michael. Welcome to Go Time. |
**Michael Matloob:** Hi! Great to be here. |
**Mat Ryer:** Oh, it's a pleasure to have you. Michael's on the Go Tools team at Google, living in, you know, New York City, no big deal... And he previously worked on go/packages, which is very useful if you're writing code generation tools and things like that, and infrastructure for tooling. And now he works on the ... |
**Michael Matloob:** Yes. |
**Mat Ryer:** And do you pinky-promise to not mention those two big subjects on this very episode? |
**Michael Matloob:** I won't mention them by name. |
**Mat Ryer:** Okay, that sounds like a good pinky-caveat... |
**Michael Matloob:** It is. It is a pinky-caveat. |
**Mat Ryer:** Okay, fine. We won't mention them by name. We'll see how it goes. So this episode -- obviously, there's a lot of people blogging and talking about the big headline features. A lot of people are very excited, a lot of people are very dismayed about generics in particular; I've just said it, and I can't bel... |
**Daniel Martí:** I believe they've been saving a few large features for some time. They've been building up the generics for nearly two years now, and now it's shipping, right? And I did mention the taboo subject, but I think it's also happened with fuzzing, which has been in the works for like a year now. |
**Mat Ryer:** Yeah. I see. By the way, just mentioning another taboo subject doesn't cancel out the other one. You're just compounding your crimes. I asked Daniel and Michael to find a list of the things that they're sort of excited about, or interested in, that we can go through and talk about... And obviously, Michae... |
**Daniel Martí:** Yeah, so I think anybody who's written any non-trivial amount of code knows that they have to deal with strings, they have to add strings, look at prefixes and suffixes and so on, and one quite common operation is wanting to cut a string in two. For example, maybe you've got a domain name and you want... |
**Mat Ryer:** Yeah, that's nice. So if say you were cutting on a colon and there wasn't a colon in there, it wouldn't be in any way like a panic or a problem. You'd just get a false as the second argument. |
**Daniel Martí:** Exactly. |
**Mat Ryer:** Yeah. What do you think about that, Michael? Have you written code that cuts things up like this? |
**Michael Matloob:** I have, yeah. It would be a nice convenience. I like conveniences. |
**Mat Ryer:** Yeah. I thought this was like an unnecessary helped, because whenever you can already do something, that's usually my preferred way. I looked at some of the commentary on this one, and the number of cases where people are basically doing the same operation over and over again is kind of everywhere. And in... |
\[08:05\] If there was some testing tool that helped you test out all these different possible ways of responding to input, that'd be great; but not on this episode there isn't. But yeah, okay... So strings.cut, and that's coming in Go 1.18. Okay, Daniel, have you got another one for us? |
**Daniel Martí:** So I've got another one that's significantly more complex than strings.cut, and I believe it was developed by the people at Tailscale over a few years. It's essentially a replacement for the net.ip type. Right now, IP addresses in Go - they're represented as a byte slice. So you can think of a byte sl... |
**Mat Ryer:** So will the standard library - bits of it - be rewritten to use this new type, or is this just gonna be something that's available for calling code? |
**Daniel Martí:** I think that's a good question. I think anything that exposes APIs with the old type will have to remain the same because of backwards compatibility. I seem to recall one of the reasons to add this to the standard library is so that, for example, HTTP/2 and /3, which -- I think it's only HTTP/3 which ... |
**Mat Ryer:** Yeah, that's nice. And do you know if there are gonna be helpers to switch between the two? Do you think we're gonna see code like that flying around for a bit? |
**Daniel Martí:** I believe the package comes with helpers, but my memory is failing me... |
**Mat Ryer:** Okay. I mean, if not, people will probably end up doing that, I imagine... But yeah, it's nice to know that there's a sort of improved data type there. And it's funny - you know, with the Go backwards compatibility promise you can't just break things, and break APIs, and break everyone's code. It's not Py... |
But with that promise, of course, your hands get tied. So this is kind of a nice way of releasing almost like more modern implementations, is to sort of release them alongside, and then they kind of co-exist. But does that create confusion? Like, how will people know which one to use? |
**Daniel Martí:** That's a good question. I think the Go standard library has a bunch of cases where there are packages and APIs that everybody knows not to use. There's container/list, that has like a linked list, for example. I don't think everybody's used that outside of an example... I don't think they can deprecat... |
**Mat Ryer:** Great. Thank you, nice one. Alright, Michael, maybe you could pick one to talk about next... |
**Michael Matloob:** I'll pick a couple of features that my colleagues Jay and Ryan added to the Go command. So they are vcs build stamping, and a debug buildinfo function to get information about the versions of modules in a Go binary as an API. |
**Mat Ryer:** Hm... |
**Michael Matloob:** \[11:49\] Both of these have a similar core motivation, which is like to improve visibility into binaries and which packages they were built on, so you can determine, say, if binaries were built with certain commits of code, in the case of vcs build stamping, because the main module may not have a ... |
This is shaping up to be a big thing in these days, to know whether your dependencies and the code they are built with have bugs or bad features in them, and if the code that you're running with is safe, and to audit everything properly. We've seen several cases of bad libraries in the wild, and people have to quickly ... |
**Mat Ryer:** Yeah, and it's a tricky thing. So unpicking that a little bit then... So vcs, version control systems, like the Git hash when you have a certain level that you've committed up to, and everytime you commit, you get a new hash... And so now when we build, that will be incorporated. Is it like it supports al... |
**Michael Matloob:** Yeah, yeah. I mean, it definitely supports Git. I don't know other vcs'es we support. Dan, do you know? |
**Mat Ryer:** But they will be coming soon. |
**Daniel Martí:** I think there's Mercurial, Bazaar, Subversion, and that might be it for these days. |
**Mat Ryer:** It's a good selection... Could you name five? \[laughs\] |
**Michael Matloob:** Five vcs systems? |
**Mat Ryer:** Yeah. Just five, dead-quick. |
**Michael Matloob:** Well, Dan named four, so... |
**Mat Ryer:** I know. So it should be easy. |
**Michael Matloob:** I've seen in the Go command a vcs named Fossil that had support somewhere... So that'll round us out. |
**Mat Ryer:** There we go. Fossil. There we go. Five. Brilliant. Learning. Okay, and the other thing is that buildinfo, with all the dependencies, because that is a big thing. We're paying a lot more attention now to reporting vulnerabilities, capturing that data, and then being able to, in the tooling, use that to kno... |
**Michael Matloob:** My understanding is the buildinfo is like a function that's like accessible to programs that were just in the Go command before, like go version -m. So it makes it easier for other people to write these auditing programs that can help detect if there are bad versions in your dependencies, and then ... |
**Mat Ryer:** Yeah. Well, it's very useful if you have Dependabot running in your continuous integration, or just running in GitHub... Having those tools help. It's all great, so anything in that effort I think is worth having. Very cool. |
And yeah, before we had to use either build tags or do something else funky to get the version. I would always do that, I would have some script that would -- I think I did it with Go Embed as well, successfully, recently. But we just don't have to do that now. And so will we be able to access that version inside the b... |
**Michael Matloob:** Sorry, access the -- |
**Mat Ryer:** Access the Git hash inside the binary itself? |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.