text
stringlengths
0
2.35k
[1747.42 --> 1752.44] And I suppose naturally you'll also cover a lot of those cases that you talked about as well.
[1752.98 --> 1754.98] I like Go Run as well.
[1755.32 --> 1767.50] Go Run is like a, it, you don't tend to have much magic in Go, but Go Run is probably the magic tool because it actually secretly does a build and then executes,
[1767.50 --> 1777.86] you know, it does a few steps behind the scenes, but it's great if you're just learning to code or you just want to write a little script quickly and just execute a program.
[1778.04 --> 1785.32] You can use Go Run and you pass in the name of the file or files and, and it just runs it.
[1785.38 --> 1788.46] I mean, it builds it to a temporary directory and I think it gets deleted afterwards.
[1788.68 --> 1789.54] Well, I'm not sure.
[1789.54 --> 1799.70] Um, but yeah, I think that also is, it's such a nice thing to be able to just quickly see results and see feedback from what you're doing.
[1799.90 --> 1802.10] And Go Run is another example of that.
[1802.38 --> 1802.90] Yeah.
[1802.92 --> 1806.90] I think, uh, people use Go Run for their like first Hello World program.
[1807.42 --> 1809.76] Um, it sometimes becomes like complicated.
[1809.76 --> 1812.96] So then they, you know, have this habit of like using Go Run.
[1812.96 --> 1822.06] Uh, Go Run, I think before Go Pad was a little bit more difficult to rely on because it was some sort of like, you know, it was able to work outside of Go Pad.
[1822.46 --> 1826.68] So, um, the behavior of Go Build and Go Run was not quite the same.
[1826.68 --> 1834.70] So, you know, it's just kind of like people have been advocating to always rely on Go Build or install rather than Go Run.
[1834.90 --> 1840.66] But I think like, it's just really nice for a Hello World or if you have a script type of thing that you just go run.
[1840.66 --> 1842.00] Um, it's still useful.
[1842.74 --> 1843.10] Right.
[1843.20 --> 1851.92] The, the Go Run, I think, yeah, like you were right, um, Matt, when, when you're saying basically it, from my understanding is that this, it does the same thing as, as Go Build.
[1852.06 --> 1856.68] It's just the difference being that, okay, once a program is run, it just discards that temporary artifact.
[1857.34 --> 1861.18] Um, at least that's, that's, that's the high level of what I think it does.
[1861.52 --> 1866.56] Um, one thing is worth mentioning is also you can run it with a, I believe it is run, you can run with a dash race as well.
[1867.04 --> 1870.36] Um, that way, you know, if there's any sort of a race conditions in the code,
[1870.36 --> 1879.44] it'll actually, um, when, if, when the program fails, if it panics, um, then you'll actually get some information around, um, where that sort of a race condition occurred as well.
[1880.58 --> 1880.98] Hmm.
[1881.56 --> 1882.54] I didn't know that.
[1882.94 --> 1883.60] That's brilliant.
[1883.60 --> 1883.88] Yeah.
[1883.92 --> 1893.10] I think race is, race is supported in, um, like test, build, um, run, like general all across the tools.
[1893.50 --> 1893.70] Hmm.
[1893.70 --> 1893.82] Hmm.
[1894.42 --> 1897.18] But you, but it adds overhead, doesn't it?
[1897.20 --> 1898.80] And slows down your program and things.
[1898.84 --> 1901.18] It's not something you would just always switch on.
[1901.66 --> 1902.04] Yeah.
[1902.04 --> 1906.88] That's why I think it's useful to just, you know, make it, uh, an optional thing for tests.
[1907.10 --> 1912.50] Um, but you know, apart from that, like you don't want to have the race detector always on.
[1913.28 --> 1913.68] Yeah.
[1913.68 --> 1917.74] I've, I've had mixed results depending on the size of the code base, obviously.
[1917.98 --> 1922.76] Um, the, but these days I work on a lot of somewhat small, um, code bases.
[1922.90 --> 1924.64] I work a lot with my services, that kind of thing.
[1924.70 --> 1928.14] So these, these code bases tend to be somewhat small, relatively speaking.
[1928.14 --> 1932.72] Um, so I, I, by default, whenever I, my, the default make command, right.
[1932.80 --> 1933.46] For, I use make.
[1933.58 --> 1939.42] So when the default, whenever I run make for the default is basically to just run it with the dash race flag, run the test with dash race flag.
[1939.42 --> 1947.74] Um, I, I haven't noticed, um, significant slowdown in that, but again, you know, obviously your mileage is going to vary depending on the size of your project and how many pages we got going on.
[1948.16 --> 1960.18] There was a benchmark about this and like, um, I think it was kind of like memory usage is again, like five times, you know, larger if you, um, have the like race detector on.
[1960.30 --> 1966.64] And I think execution time wise, like, again, like there was like some reports, but it's really dependent on the use case, as you say.
[1966.64 --> 1973.52] So it's kind of like adding some overhead, which could be, I think, um, two to 20 X or something.
[1973.52 --> 1976.22] If I can, you know, remember the numbers correctly.
[1976.46 --> 1983.46] Uh, there's a really good blog post actually, or an article on the, uh, go lang.org about the race detector.
[1983.76 --> 1986.24] And, uh, there must be like some numbers over there.
[1987.46 --> 1988.26] Yeah, cool.
[1988.38 --> 1988.64] Okay.
[1988.94 --> 1996.30] Well, so I was thinking as well about, um, go get, go get, go get another one of the tools, which I think, you know,
[1996.30 --> 2000.62] obviously things have changed a lot, especially in the module space.
[2000.96 --> 2009.64] Um, but I've got to say when I was first using go to just be able to install packages by saying, go get, and then the package name.
[2009.64 --> 2016.46] And then for that package name also to be the import path and to be the URL of where that package lives.
[2017.10 --> 2024.96] Um, I found that to be such an elegant thing that it was very easy to, to install things.
[2024.96 --> 2030.06] I mean, this is when we had, this is in a go path world where everything just gets put into one place.
[2030.06 --> 2034.58] Um, but go get just really made that very, uh, very easy.
[2035.26 --> 2039.88] Um, how do you feel about go get versus the new module tools?
[2039.88 --> 2043.58] Cause they're the, the working with modules is, is a little bit more complicated.
[2044.46 --> 2051.70] So, um, I'll, I'll, I'll punt the modules, um, to, uh, to JVD and let her tackle that.
[2051.70 --> 2061.88] But I can tell you that for the, when using go get, like, especially when I'm teaching, like being able to say, look, like we're gonna, we're gonna import this package before we can actually import this package and use it in our code.
[2062.10 --> 2063.36] You know, we need to go get it.
[2063.40 --> 2063.58] Right.
[2063.58 --> 2067.80] So, you know, I'd literally say, okay, go get, and then basically I'd find the name of the package.
[2067.80 --> 2074.20] If we qualify path, basically, you know, with github.com, whatever, um, or whatever the, wherever the public repository is.
[2074.70 --> 2078.62] Um, and then, you know, and then basically I'd get this blank stare from the students.
[2078.62 --> 2080.42] They'd be like, okay, what just happened?
[2080.92 --> 2092.02] You know, and then it, I, it dawned on me that, okay, if I literally copied, right, that path, go into the browser and paste it into your URL bar and navigate to that repository.
[2092.76 --> 2095.08] Immediately they were like, oh, okay.
[2095.08 --> 2098.06] I see, I see what this is, right?
[2098.08 --> 2102.32] You are literally pulling this code that lives at this very path, right?
[2102.34 --> 2104.76] You're putting on the command line, you are pulling it down.
[2104.76 --> 2111.30] Now I can actually see and read that code, you know, in my browser and see what it is I'm actually pulling down, right?
[2111.30 --> 2115.52] So the whole thing about, you know, pulling down the package, you know, it goes in your go path.
[2115.72 --> 2118.26] None of that stuff makes sense, right, for them.
[2118.32 --> 2124.24] But the moment that I can actually go into a browser and put that very path in, it sort of clicked, right?
[2124.24 --> 2133.72] They, now they understood the value of GoGet and it didn't quite, you know, it didn't matter really much where it was being put in the go path.
[2133.88 --> 2135.96] It's just the fact that they knew how to get it.
[2136.04 --> 2140.36] They knew how to go, where to go and see whatever was being pulled was, was almost magical for them.
[2141.72 --> 2143.64] Funny because it's no magic.
[2143.64 --> 2148.56] And it's almost the fact that it's so obvious, i.e. that's the URL, go and look at it.
[2148.68 --> 2149.90] You know what a URL is.
[2150.84 --> 2153.36] I think that that's great.
[2153.66 --> 2156.92] And that you, the little story you just told then makes total sense.
[2157.00 --> 2166.56] I mean, when, when I use, if I use some NPM stuff for a project, I install a few things and I look in that node modules folder.
[2166.72 --> 2168.70] There's 16 million folders in there.
[2168.70 --> 2174.48] And yeah, and I don't know where they've come from.
[2174.82 --> 2176.24] It's kind of hidden.
[2176.58 --> 2177.70] It's, it is magic.
[2178.14 --> 2194.64] Whereas it's just, you know, that thing of being very simple and clear, even if you sacrifice some features for that, I always think is, has, has such a positive kind of dividend that it keeps paying again and again later.
[2194.64 --> 2198.62] I think we need to make an episode on go month.
[2198.96 --> 2202.88] But I think go, I agree that like go get is a really good, you know, initial experience.
[2203.32 --> 2214.62] And one thing I like about is if, if you're go getting a main package, it, you know, installs it, puts in your go, go pat being directory.
[2214.62 --> 2215.06] Yeah.
[2215.06 --> 2218.62] So it's just like a good way to, you know, distribute tools as well.