Few notes on Go assembly

A collection of practical notes and references for understanding Go’s assembly language and pseudo-assembly compilation process. ...

January 12, 2025 · 1 min · 171 words

Go slices mind-twister

This snippet of code got me off guard. Having a somewhat decent experience with golang I could not explain what is it doing and it took me embarrassingly a lot of time to figure out a sound explanation for what was going on. After I figured out the answer, I think that my sleep deprivation just played tricks on me. Still let’s dig into this. Down below is the same snippet but with a slice of integers for simplicity: ...

May 5, 2024 · 4 min · 836 words

Case of a leaking timer in go

It was only an accident that I read a post on ArangoDB site and found the same leak in one of our projects at work. So this is going to be quite short, but nevertheless I want for have it in form of a blogpost. Here is how leak looked like: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 package main import ( "fmt" "runtime" "time" ) func main() { messags := make(chan string) for { select { case msg := <- messages: // do smth with msg fmt.Println(msg) return msg case <-time.After(time.Second * 3): // do smth else fmt.Println("3 sec timer fired") case <-time.After(time.Second * 30): fmt.Println("30 sec timer fired") return } } } What is wrong with it? There is a lot: ...

November 13, 2022 · 3 min · 449 words