text
stringlengths
0
2.35k
**Roger Peppe:** An order of magnitude... Yeah, no, Egon tipped me off, yeah... \[laughter\] He didn't, he didn't. I just know how big these things are.
**Egon Elbre:** Okay. The other common one is gRPC.
**Mat Ryer:** Yeah. Well, I know that's a binary format, so that sounds small... A billion. \[laughs\] I've learned my lesson.
**Roger Peppe:** \[08:06\] gRPC is -- well, that includes all the protobuf too, right?
**Egon Elbre:** Yes.
**Roger Peppe:** So we're talking like maybe 120,000 lines of code.
**Mat Ryer:** Oh, it's going to be more than--
**Egon Elbre:** In the same ballpark, so 100,000.
**Mat Ryer:** Ah... Roger, you're suspiciously close to these. Do you count lines of code?
**Roger Peppe:** I have too much experience with large code bases. \[laughs\]
**Mat Ryer:** Yeah, apparently... That tells you something though, because it'd be very easy to just build what you imagined to be a very small project, and just import one of those two technologies, and suddenly, you're really talking serious, serious numbers.
**Roger Peppe:** Yeah, compared to Net RPC, if you remember that package that not many people use, which is only about a thousand lines of code, or a couple thousand lines of code...?
**Egon Elbre:** Yes, something that.
**Mat Ryer:** Is that why people don't use it? It's not enough -- people are like "I'm not buying it unless it's got loads of lines of code in it."
**Roger Peppe:** I mean, gRPC also has its entire copy of the HTTP, another copy of the HTTP/2 stack, and that kind of thing. So it seriously reinvents many wheels.
**Mat Ryer:** So would you have to import that to use it in a project? Or is that just like the toolchain needs that?
**Egon Elbre:** No the code that you import, and the compiler has to parse through, essentially.
**Mat Ryer:** Hm... Well, you just don't notice, because Go's build times are so -- they're so fast. Maybe we're spoiled by that a little bit.
**Egon Elbre:** Every single line of code, that's one second to your build time, so...
**Mat Ryer:** \[laughs\] Well, that's what it used to do... That'd be good. You'd pay attention to code bloat if that were the case, wouldn't you?
**Roger Peppe:** I think it's all just got so ridiculous, from my point of view... It started off back in the '80s, where like 16k was a huge amount, was a very large program. And now it's in the many hundreds of megabytes, and "Well, doesn't matter...?" Well, does it really matter? I don't think it does, from my point...
**Mat Ryer:** Yeah, right. So that's the other side of this then, is as a project grow and grow, you have to maintain them. Sometimes you can just leave code for ages and you never really have to touch it, but you still have the cost of maintaining that, don't you?
**Egon Elbre:** I consider every single line of code that you are the maintainer of it now.
**Mat Ryer:** Yeah. Every line of code...?
**Egon Elbre:** Because maybe the maintainer goes on vacation, and you have a critical bug that you need to fix.
**Roger Peppe:** So you've personally reviewed all those lines of gRPC code?
**Egon Elbre:** Yes.
**Roger Peppe:** Good work...
**Egon Elbre:** Luckily, I don't have to do it anymore.
**Mat Ryer:** You do that every time there's a new release? Or do you just read the diffs, and then apply that in your brain?
**Egon Elbre:** No, we dropped actually gRPC for that maintain reason.
**Mat Ryer:** Yeah. So that's interesting then... When you import a package, it's because it's such an easy thing to do... I wonder how many people think I am committing to also taking on the responsibility of looking after this entire other project as well. I don't know that many people have that mindset, do they?
**Egon Elbre:** I think it depends on the background, where you come from. So if you start out by building websites and all that stuff, then probably you don't think about it. I used to work for an electronic medical records company, and every single dependency had to be thoroughly reviewed, and whether it's suitable. ...
**Mat Ryer:** Yes. For sort of regulatory reasons, I guess...
**Egon Elbre:** Yeah.
**Roger Peppe:** Yeah, I have to say that I don't personally review all our dependencies, because I don't have the time... But if I take on a dependency, I look at the dependencies of the dependencies often. I'm always more concerned about that. If something just depends on the standard library, I feel that I've got a ...
**Mat Ryer:** \[12:23\] Yeah. So how do you do that? Do you have to manually go and look at all the projects?
**Roger Peppe:** I look at go.mod, actually, and I'm like "Why have I got that dependency? Do I need that dependency? How can I strip it out?" And I was doing that a while ago with some fairly large codebase, "Why have we got this --" And I came across -- that was actually probably what ended up with me on this call ac...
**Mat Ryer:** Hm. What is that project, Egon?
**Egon Elbre:** So it was for solving this problem of understanding your dependencies. So it stands for Go Dependency Analysis Toolkit. So I ended up collecting these different tools, and then I eventually merged them into a single, large bundle of them. It's at github.com/loov/goda. And it has features for -- I try to...
**Mat Ryer:** Yeah, that sounds really good. I mean, as a rule, I kind of agree with you, Roger - if I'm going to import a package, I'll prefer ones that have just a few dependencies. And even sometimes I used to just copy bits of the code in, with the license at the top, always, just to kind of avoid it... And often t...
**Roger Peppe:** Personally, yes, I would. But I'm biased, right? Because I maintain a package called -- I'm trying to think what it is now... QuickTest. I'm one of the maintainers of that. Which does not have many dependencies, and it's a bit smaller, so I quite like that... Because Testify has lots of dependencies. B...
**Egon Elbre:** When I bring in dependencies, I actually do review most of the lines of the code. I also run our usual linter suite through the codebase. And this means that if we import a new package, usually there are a few fixes that we contribute upstream already. Maybe there's a data race, maybe there's a global v...
**Roger Peppe:** The other thing that the Goda tool is really useful for, I've found, is trying to sort of -- a code bloat which we haven't really talked about is code bloat in your own codebase. So when your code base gets really big, and you've done some changes, and you've made some big migrations, but you've still ...
\[16:21\] Of course, Go is fantastic because of a great rule that it has - you can have no cyclic dependencies. That is amazing, actually. That rule, just in itself, has contributed hugely, I believe, to the maintainability of larger Go codebases. Because without it, you tend to get in a situation where something at th...
**Mat Ryer:** Yeah. So for people that don't know, this is where you'll have, say, three packages. A imports B, B imports C; that'd be fine. But it's when then C imports A, and you get this strange circle, right? Is that right?
**Roger Peppe:** Yeah, that's it. And also, it's a really good rule, but it was also really frustrating at times, because there are times you're like "Oh, dang, we need to import this from here and we can't, because it says cyclic dependency." So then you have to break your dependencies, and often you have to split up ...
**Mat Ryer:** Yeah. And that's the thing; it's like, take on the pain early. A stitch in time saves nine, which means if you can stitch with one, do it early, a little bit of pain; it saves that, because it grows, and it becomes much more painful later. I've had the same thing too, and one of my approaches is actually ...
I quite like it when the structure emerges, rather than is imagined... Because sometimes it's obvious, and sometimes I've got dependencies that -- I've got something that I know it's going to be a package, I know it's going to be useful in multiple places... But I'm often surprised as well, as the application is being ...
**Roger Peppe:** I agree with that, yeah. Definitely.