I am preparing some code for a another blog post I came across some very unexpected behavior on my terminal that really got me thinking 🤔. Time was behaving in 2 different ways depending on what it seems an entirely unrelated reason.Continue reading “Unix bash shell and the time command output”
Writing code and building software is fun no matter which language one uses. But what we have found is that there is no “language to rule them all”. There are a number of languages out there each with its own quirks, strengths and weaknesses and that’s just amazing.
So where does that leave us as software engineers? We will probably need to pick up more than one languages as we go along, but what’s the best way to go about that?Continue reading “5 things to sort out as a multi-lingual software engineer”
A lot of things in life are a matter of perspective and visibility and the same applies to variables in Go 😅. But what is a variable’s scope, how is it defined and what does it mean to shadow a variable in Go?
Let’s (very) loosely say that the scope of a variable declares where this variable is visible from ie. if we have declared a variable at the top of the file then it’s visible from within the entire code of that file.
We can go even deeper than that though and we can break this question down into Go specific terms.Continue reading “Variable scopes and shadowing in Go”
Problem definition: Given a slice of integers sort them in ascending order
Bubble sort is an iterative comparison algorithm that sorts the elements by swapping them around if they are out of order. If a larger element comes before a smaller one => swap them and move on to the next position of the array.Continue reading “Sorting in Go using Bubble sort”
Writing code has its perks for sure and for me one of these is the satisfaction of being able to think of something and then just write the code to bring it to life.
After all the writing, testing, debugging and adding and removing lines and lines of code it’s nice to be able to look back and visualize all the hard work that you have put into creating your pet project.Continue reading “Code visualization with Gource”
Since version 1.7 the Go testing package provides the ability to run some of the tests in parallel (well not entirely in parallel but that is another blog post 😉).
This is optional functionality you can enable by adding a single line of code
t.Parallel() in your subtests. But how does that work exactly and what does Go actually do with these tests?
I find the way that strings have been implemented in Go to be really interesting but also a bit confusing when you are first introduced to them. Go has native UTF8 support, which flows through how the source code is written to how strings and “runes” are represented (runes is the thing that really got me by surprise but more on that later). So what does Go do differently with strings that is worth mentioning?Continue reading “String manipulation in Go”
Doing a major version upgrade is always fun so this is no exception. I use Twig for my PHP projects so I run into multiple little snags whilst upgrading to version 2. I have listed the most interesting ones here with the errors I was seeing and the recommended updates:
- macros defined in parent templates
- the spaceless block
- nested blocks in other statements