Test coverage in Go, working with packages and sub-packages

A test suite for any package is explicitly testing different code paths and identifies how your code works using different inputs. But does it actually manage to cover all the code branches that exist in your code? How about all the different functions?

One way to answer these questions is to thoroughly look at all the tests written (by you and your colleagues) and understand if there are any gaps. The easiest way to do that though is to use a tool, and in the case of Go this tool is called cover.

There is an excellent blog post on the Go Blog, called “The cover story” that describes how Go uses the cover tool to generate reports that I definitely recommend reading. In this post we are going to analyze a few parts of how the cover tool works and also provide a way to use it for packages which include sub-packages.

Continue reading “Test coverage in Go, working with packages and sub-packages”

Learning more about R (a.k.a. Reproduction number) and COVID-19

R is a number used as a simplified indication of how quickly COVID-19 (or any other infectious disease) is spreading and how critical it is to take additional measures to control the spread of the disease.

R values per country as of the 17th of December 2020 (source: http://metrics.covid19-analysis.org/)

But what exactly does R represent, what are the values of R around the world and are there any resources we can use to see how it evolves over time? I am going to share what I learned but fair warning: I am not a doctor or an epidemiologist so please also do your own research using sources you trust.

Continue reading “Learning more about R (a.k.a. Reproduction number) and COVID-19”

Debugging in Go with Delve

There are different ways of debugging a Go program. You could use print statements to view the values stored in your variables during the execution or you could use a debugger. Some IDEs, like GoLand, offer this functionality by default but it is also interesting to see how to use the integrated solutions from the command line. Delve offers both command line clients and an API that can be used to integrate it to other tools (which is actually what GoLand uses under the hood).

Delve logo
Continue reading “Debugging in Go with Delve”

Abstract Syntax Trees (ASTs) in Go

An Abstract Syntax Tree (AST) is a tree representation of the structure of a piece of code used mainly in compilers. ASTs can also allow us to traverse existing code and use the information collected to auto-generate new code, which we are going to do in this post! The structor is a command line utility we are going to build that given a domain package with struct definitions it automatically generates getter and setter functions for the fields of the structs.

Basic Go AST structure of a single file
Basic Go AST structure of a single file
Continue reading “Abstract Syntax Trees (ASTs) in Go”

Skills to develop as a Technical Lead

Photo by Miguel u00c1. Padriu00f1u00e1n on Pexels.com

In the Divergent Tech Lead post I talked about a number of different interpretations of what a Tech Lead means. Since the role is by no means straightforward – you may need to develop different skills depending on your current team.

In my journey I have focused a lot on gaining specialized Domain Knowledge, building up Technical expertise, working on effective Team organisation & Planning, and perhaps most importantly clear & comprehensive communication. Let’s have a closer look at what all these really mean.

Continue reading “Skills to develop as a Technical Lead”

What learning to play the piano reminded me about software engineering

A couple of months ago I decided I wanted to learn a bit more about music so I decided to learn how to play the piano. This is an entirely new world for me, as I have practically zero prior knowledge. Little did I know then of how similar my experience was going to be to when I started writing code!

Continue reading “What learning to play the piano reminded me about software engineering”

The Divergent Tech Lead

Some time ago I decided to do a little research in an attempt to figure out which are the most often requested skills that a Tech Lead is expected to have. If you are interested in that post, it’s here.

Photo by Miguel u00c1. Padriu00f1u00e1n on Pexels.com

Back then I was not surprised to see that there isn’t a universal set of skills that a Tech Lead is expected to have. Quite the opposite actually, different people perceive the role in different ways and have quite different expectations. This has led me in a definition I call the Divergent Tech Lead. But let’s start from the beginning …

Continue reading “The Divergent Tech Lead”

Go routines and thread safe data structures

A simple definition of Go routines is found the “Tour of Go” section about concurrency:

a Go routine is a lightweight thread managed by the Go runtime

Now if you have not come across threads before, threads is a way for a program to run parts of itself in some sort of concurrent way. In this post we are going to examine the differences between running a program sequentially, using Go routines and Wait Groups and we are going to talk about thread safe access to a data structure. So… Let’s get started 💪!

Continue reading “Go routines and thread safe data structures”