VictoriaMetrics Observability Blog

Filter: Open Source Tech

Go sync.Mutex: Normal and Starvation Mode

Mutex in Go has two main flows: Lock and Unlock and 2 modes: Normal and Starvation Mode. The state field of mutex is a 32-bit integer that represents the current state, it’s divided into multiple bits that encode various pieces of information about the mutex.

How Go Arrays Work and Get Tricky with For-Range

As always, we’ll start with the basics and then dig a bit deeper. Don’t worry, Go arrays get pretty interesting when you look at them from different angles. Arrays in Go are a lot like those in other programming languages. They’ve got a fixed size and store elements of the same type in contiguous memory locations.

Golang Defer: From Basic To Traps

The defer statement actually has 3 types: open-coded defer, heap-allocated defer, and stack-allocated. Each one has different performance and different scenarios where they’re best used, which is good to know if you want to optimize performance.

Vendoring, or go mod vendor: What Is It?

Vendoring is a different strategy as it keeps a copy of all your project’s dependencies directly within the project’s directory, rather than relying on an external cache.