Grabbing a Go Time with BPFTrace

Recently I found myself debugging an application where I needed to understand what value a time.Time object had. What I thought was going to be a trivial experience turned into a multi day confusing conundrum which left me confuddled and cranky. Alright, that is already too much alliteration for the first paragraph of the post. Long story short, I gave up and found a duration which gave me the context I needed to understand what was going on. ...

October 7, 2024 · 10 min · 2095 words · Paul Montag

Go Nil Slice

var names []string for _, person := range bus.People() { names = append(names, person.name) } This probably looks pretty familiar. If it doesn’t and you are like “OMG, how is that working?!?! Doesn’t that nil panic?!”, no worries, append will instantiate the slice for you. However you are leaving it up to Golang to guess how many items will end up in the final slice, and it has 0 context. Let’s dive into what a slice is under the hood. ...

March 12, 2024 · 7 min · 1416 words · Paul Montag

BPFTrace and Go

You know what is awesome! BPFtrace! There is nothing more magic than showing someone exactly what is happening in their application, RIGHT AT THAT MOMENT. There is something neat about peering under the hood of a running application and finding that your pristine software, your baby which you have labored over making perfect is still marred with logical errors that don’t show themselves when viewed holistically. Sadly, when you are reaching for something like BPFtrace you are typically in a bind, and the complexity of such a tool is frustrating. This is compounded by the fact that Go, in no way, makes your life easier here. Hence I will write down what I know in hopes to clear someone else’s frustrations. (more likely my future self) ...

January 28, 2024 · 10 min · 2080 words · Paul Montag

Go Heap Allocations

Recently I found myself caring about performance. Usually, with go, you don’t have to care if something is on the stack or the heap. Since Go is a garbage collected language all those details are taken care of for you. Worrying about these things is a pre-optimization, and the community is very happy to tell you so. However, there is the rare event performance takes precedence, in which case the favor of garbage collection turns into a frustrating scavenger hunt. ...

January 24, 2024 · 6 min · 1164 words · Paul Montag