Why didn’t I think of the very helpful Go module “net/http/pprof” earlier? This way I can profile my blog live. 🤓 (And hopefully find parts that I should or can optimize.)
Tags: Go
SQLite without Cgo
On Saturday morning I experimented a bit. Whenever I used SQLite in a Go application, I used the popular package mattn/go-sqlite3. Not a bad choice, after all it implements the database/sql interface. One drawback, however, is the need for a C compiler, since Cgo is used to run the original SQLite code in the background.
“Darker Corners of Go”
Another entry from my reading list: “Darker Corners of Go”. Rytis Bieliunas has taken the effort to write down all the points to consider when programming with Go. A lengthy list, even if I personally find Go simpler than, say, Java.
go-shutdowner: Simple graceful shutdowns in Go
As I already mentioned, I’m trying to modularize parts of GoBlog to make the code more organized and to be able to test it better (thanks to the tests, I always notice small bugs that I can then correct).
TIL: gob
Today I learned about gob. gob is a package from the standard library of Go and allows to store structs efficiently as a byte array. Faster than encoding data in JSON for example. Useful for communication between Go programs or for temporarily storing data. In GoBlog, I’ve recently been using gob for a SQLite-based queue for verifying webmentions and sending ActivityPub requests. gob has the same interface as the JSON package.
Modularizing GoBlog?
I just separated the function I told you about the other day (the one for marking text with “==”) as a Go module. This way the main code remains more organized and if I don’t need the feature any more, the module is still usable. Also for other people who might need the same functionality. I think I should modularize GoBlog even more. 🤔
“Improving large monorepo performance on GitHub”
I always find it interesting to learn how well-known services work under the hood and what efforts are being done behind the scenes to solve performance or other productive issues.
How a clever organization of Go structs can save memory
Sometimes I like to take a look at the commit history of various open source projects, applications I use myself or dependencies I use in my applications. Today I was scrolling through the commit history of chi, the HTTP router I use for my blog software.
Generics in Go
As someone who properly learned to program using Java and still works with Java almost every day, I am used to generics. Flexible parameters whose constraints do not yet have to be set during definition. The fact that there are no generics in Go took some getting used to.
Advent of Code 2020 in Go: Week 1 and Week 2
Instead of making a post every other day with all the solutions, here are my approaches for the rest of week 1 and week 2 of Advent of Code 2020.