In my opinion, Go provides excellent support for concurrent work, not only due to goroutines but also because of the language’s ecosystem. A great example of this is the sync package, which helps synchronize concurrent routines. In this post, we’ll dive into everything this package has to offer. Waitgroups Waitgroups are used to coordinate the execution of multiple routines. They make…
Imagine the following problem: you need to process hundreds of records and generate a single output. One way to solve this is to process each record sequentially and unify the output only at the end. However, this can be extremely slow, depending on the time spent processing each record. Another way is to process them concurrently, speeding up the overall time. In my post about introduction to…
In a previous post I showed some ways to improve tests by creating API mocks that we call. However, that’s not always enough, and we might need E2E tests (or acceptance tests), for example, to test integrations with databases, messaging services, or anything else. For these cases, I’m here to introduce the Testcontainers tool. The Testcontainers library is an open-source tool that lets…
As the software we work on grows, the code tends to undergo various changes and refactorings. During this process, we might simply forget pieces of code that were once used but no longer make sense in the project, the infamous dead code. A very common example is when an API is deactivated, and only the handler is removed, but all the business logic remains, unused. What is deadcode? Dead code can…
At my Circuit Breaker post, I mentioned that nowadays it is common that the application has to communicate with other ones, and with that, traffic control strategies become essential. Recently I’ve discovered the Token Bucket, a strategy based on tokens used to control the traffic. Imagine that you have 5 tickets to a ride, and every new hour you get a new ticket, but you can never exceed…
Atualizações importantes Hey guys, editing the post to say that after talking to some people, I noticed that I whole misunderstood how Go dependencies work, and I was expecting some feature that already kind of exists, since just what is used from the code is at the final binary! A special thanks to Laurent Demailly, from Gophers Slack, and to some Reddit users! After many years working with Ruby,…
One of my favorite features in Go is the possibility of writing benchmark tests. At Go 1.24, this feature has a new look, making it easier to use. To demonstrate these changes, let’s suppose a function that calculates the factorial recursively and one that calculates it through loops. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 func FatorialRecursive ( n int ) int { if n == 0 { return 1 } return…
After reading the book The Goal , I went after the next reading, and I was recommended to read The Mythical Man-Month, from Fred Brooks. This book is a computer science class, which I didn’t know yet, that describes the software development life cycle in the 70s. Main subject The book’s main subject is told at the title: the mythical man-month. Man-month is a productivity metric like…
Nowadays, a huge part of a developer’s work consists in calling APIs, sometimes to integrate with a team within the company, sometimes to build an integration with a supplier. The other big role in daily work is to write tests. Tests ensure (or should guarantee :D) that all the code written by us works on how it is expected and, therefore, it will not happen any surprises when the feature is…
At the developing world, it is necessary to know how the application that you’re working on is behaving, and the most known way of doing that is by metrics. They can be of several types, such as performance, product, or health. Nowadays, Prometheus is the market way for collecting metrics. How it works? It is an open-source service maintained by CNCF , the Cloud Native Computing Foundation.…