text stringlengths 0 2.35k |
|---|
[1248.76 --> 1255.68] I tend to write unit tests which run very quickly and then you can run those every time you save the package. |
[1256.12 --> 1262.40] Usually, you know, if they start getting too slow, then of course you have to have a different strategy. |
[1262.54 --> 1269.32] But certainly in the beginning, if it's unit tests that just run very quickly and the build time in Go is still phenomenal. |
[1269.32 --> 1275.32] We always kind of forget about it until you have to go and build a different code base. |
[1275.52 --> 1277.38] Then you appreciate it again. |
[1278.24 --> 1283.08] And Johnny, by the way, yeah, the MetaLint now apparently is called Golang CI-Lint. |
[1283.40 --> 1288.18] So if you want to install that into VS Code, it's Golang CI-Lint. |
[1288.90 --> 1291.14] That's the new name of that. |
[1291.60 --> 1292.48] Yeah, but you're right. |
[1292.54 --> 1293.42] It's the MetaLint. |
[1293.42 --> 1298.78] It runs a range of other Linters and kind of gives you that one view of it. |
[1299.02 --> 1301.32] And they integrate brilliantly into the IDEs as well. |
[1301.40 --> 1305.08] So that's the other thing, like you say, you can run it on save, but even if you don't, |
[1305.18 --> 1311.84] you can still usually integrate it into the IDE in some way that just makes it part of your routine. |
[1312.26 --> 1318.72] Because, you know, anytime you can get that live feedback from the code, that's valuable. |
[1318.72 --> 1323.96] You know, because usually as you're working, you learn too. |
[1324.32 --> 1329.50] And that's a great way to learn things as you're writing code and to see a linter saying, |
[1329.62 --> 1333.34] oh, you know, this is unreachable now or that thing's over there now. |
[1334.68 --> 1339.70] You know, and if it's tests too, then, oh, these tests are broken over here that you didn't expect. |
[1340.46 --> 1344.96] And you just get that feedback from the code, which is so useful when you're working. |
[1344.96 --> 1352.84] And you shouldn't have to wait until basically, you know, if you have CI, continuous integration, you should. |
[1353.14 --> 1359.68] You shouldn't have to wait until the code reaches, you know, that remote server where all these tools are run for you to get that feedback. |
[1359.94 --> 1361.94] It's much easier, much faster, right? |
[1362.00 --> 1365.98] Like you're saying, that feedback loop is much tighter when it's part of your tooling. |
[1366.10 --> 1369.74] So there's some things you can do locally, right, to make sure your code is funpted, |
[1369.96 --> 1373.46] make sure it's vetted, it's linted, and all that good stuff. |
[1373.46 --> 1380.22] And then when it goes up for review for PR, you know, Circle, you know, whatever CI2 you're using, Travis, Circle, whatever, |
[1380.70 --> 1381.66] there's dozens of them. |
[1381.80 --> 1388.00] So you can sort of, you know, they give it a blessing, and then now people can just focus on what does the code do, right? |
[1388.02 --> 1392.42] They don't have to tell you, hey, you forgot to, you know, run GoFundit or something, right? |
[1392.48 --> 1394.04] You take advantage of these tools locally. |
[1394.56 --> 1395.46] They're very good tools. |
[1395.62 --> 1399.90] So I wholeheartedly encourage folks to sort of make them part of your development workflow. |
[1399.90 --> 1404.18] Yeah, one of the, I think, best parts is like they are really fast also. |
[1404.44 --> 1407.82] You know, it's a part of the editing experience because they are fast. |
[1409.00 --> 1417.36] And, you know, it's just, I'm coming from like background where, you know, I use a lot of Java tools. |
[1417.36 --> 1421.50] And it's, you know, not like it is, I think, smooth the experience. |
[1421.72 --> 1426.22] We used to have like similar static tools, but it was not as smooth as all these Go tools. |
[1426.80 --> 1433.20] So nobody is making it optional because it doesn't really, you know, make the editing experience more challenging |
[1433.20 --> 1435.26] because they are fast and they are useful. |
[1435.26 --> 1449.52] This episode is brought to you by Square. |
[1449.78 --> 1454.98] Millions of businesses depend on Square partners to build custom solutions using Square products and APIs. |
[1454.98 --> 1461.84] When you become a Square solutions partner, you get to leverage the entire Square platform to build robust e-commerce websites, |
[1462.22 --> 1465.34] smart payment integrations, and custom solutions for Square sellers. |
[1465.84 --> 1468.58] You don't just get access to SDKs and APIs. |
[1469.04 --> 1476.30] You get access to the exact SDKs and the exact APIs that Square uses to build the Square platform and all their applications. |
[1476.96 --> 1479.04] This is a partnership that helps you grow. |
[1479.18 --> 1483.48] Square has partner managers to help you develop your strategy, close deals, and gain customers. |
[1483.48 --> 1490.52] There are literally millions of Square sellers who need custom solutions so they can innovate for their customers and build their businesses. |
[1491.10 --> 1492.74] You get incentives and profit sharing. |
[1493.14 --> 1497.52] You can earn a 25% SaaS revenue share, seller referrals, product bounties, and more. |
[1497.84 --> 1500.00] You get alpha access to APIs and new products. |
[1500.12 --> 1502.46] You get product, marketing, tech, and sales support. |
[1502.68 --> 1504.46] And you're also able to get Square certified. |
[1504.66 --> 1507.64] You can get training on all things Square so you can deliver for Square sellers. |
[1508.10 --> 1512.32] The next step is to head to changelog.com slash Square and click become a solutions partner. |
[1512.32 --> 1514.84] Again, changelog.com slash Square. |
[1516.98 --> 1527.62] We mentioned GoTest. |
[1527.82 --> 1529.54] That's another tool that we use a lot. |
[1530.04 --> 1534.58] Anyone that's not used it, if you write test codes in your Go programs, |
[1534.58 --> 1539.48] and you do that usually by naming the file with underscore test dot go at the end. |
[1540.24 --> 1541.68] And then you run GoTest. |
[1541.76 --> 1547.14] It will look through all those test files and it will actually run all the test code for you. |
[1547.20 --> 1553.06] And that's really how, you know, you can, if you do TDD, you know that your code is fulfilling its promises. |
[1553.24 --> 1555.40] It's doing what you said it was going to do. |
[1555.40 --> 1562.02] There's also another little feature in the test tool, which I think gets overlooked a little bit. |
[1562.24 --> 1563.90] And it's the race detector. |
[1564.96 --> 1572.08] So when you're writing concurrent code, it's possible for you to break the rules |
[1572.08 --> 1576.02] and sort of try and read and write from the same data at the same time. |
[1576.02 --> 1581.06] And if you try and do something like that, that's illegal and it will crash the program. |
[1581.40 --> 1588.30] But of course, it's very difficult to see that sometimes when you, if you've written the concurrent code |
[1588.30 --> 1593.38] and certainly difficult to write tests for it, because sometimes it might just not happen |
[1593.38 --> 1595.14] just because of the way that things get scheduled. |
[1595.14 --> 1603.20] But there is a race flag, which you can pass into GoTest, which will, it's a bit slower, |
[1603.32 --> 1613.14] but it does some additional checks and you can catch those potential deadlocks early, which is kind of cool. |
[1613.60 --> 1619.32] Yeah. And the tooling is also a part of, you know, the standard tooling. |
[1619.32 --> 1625.66] It's not just a test, but it's a really good addition that like T-SAN, you know, detector is also a part of the tests |
[1625.66 --> 1631.16] because we all have this workflow of not merging things if the tests are not passing. |
[1631.52 --> 1637.10] So you would, you know, ideally want to enable the race detector as a part of your CI. |
[1638.00 --> 1645.16] And it's amazing, but there's like one thing I think we should mention that your tests should cover concrete cases, |
[1645.36 --> 1648.94] concrete cases so the, you know, detector can detect them. |
[1648.94 --> 1654.82] If you don't represent those like concrete, you know, situations, the detector won't be able to detect them. |
[1654.96 --> 1662.06] But it's amazing because it's, it's just like so on point and it's easy and it's a part of the standard tools. |
[1662.22 --> 1668.54] So you don't have to like, you know, figure out like all these additional extra tools or whatever in order to get the benefits. |
[1669.34 --> 1675.76] Yeah. Now it's worth saying that the race detector will, if it reports that there's a violation, |
[1675.76 --> 1681.24] then that is a violation, but it doesn't necessarily catch everything. Isn't that true? |
[1682.36 --> 1682.64] Yeah. |
[1682.92 --> 1683.08] Yeah. |
[1683.60 --> 1694.40] Okay. So, but still, I mean, you know, it's still, to be honest, I've, I've never seen a race condition get through after testing it with. |
[1694.40 --> 1699.36] Because you are actually good in terms of what you care about your tests. |
[1699.36 --> 1701.10] So you represent all the cases. |
[1702.10 --> 1710.04] I've seen a lot of times people are just like, you know, not creating those like situations where concurrency is a problem. |
[1710.96 --> 1713.76] They have this, all these like super micro tests. |
[1714.14 --> 1716.50] So they don't really, you know, capture it. |
[1716.50 --> 1720.64] And I think it's really important to tell that like your tests should represent those cases. |
[1720.64 --> 1722.48] So the race detector can detect them. |
[1723.18 --> 1725.60] Hmm. Yeah. Okay. That's, that's a really good point. |
[1726.24 --> 1732.86] Well, with TDD, you tend to get good coverage, even though I don't, covering by the way, |
[1733.02 --> 1739.34] code coverage is also another part of the tooling that we just get for free, which is, is awesome. |
[1739.34 --> 1747.20] But yeah, I, I never try and shoot for a hundred percent code coverage or anything, but naturally it's quite high with TDD. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.