💻 Tech
In Go, running go vet
is a best practice to catch potential “gotchas” like loop variable scoping. But you don’t need to run it manually as it shows in VS Code’s Problems tab, and a squiggly line appears under the code. One of the “gotchas” I encountered is related to this problem detected by go vet
:
loop variable v captured by func literal
This happens if a loop variable is used in a function, essentially making it a closure. Although it’s already fixed in Go 1.22, if you’re still using an older version, you can work around it by creating a local variable or just passing the value as an argument to the function.
♬ Music
While learning about chords, some musicians align the changes in the chords (e.g., major, minor, suspended) depending on the lyrics it represent. Maybe that’s why some songs click and achieve popularity. Or this is why some songs strike a chord with the listeners.