A script for Go dependency updates
I regularly update the dependencies of my blog software, a Go based project. Dependency updates are important because they can contain security fixes or fixes for bugs.
I regularly update the dependencies of my blog software, a Go based project. Dependency updates are important because they can contain security fixes or fixes for bugs.
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.)
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.
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.
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).
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.
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. 🤔
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.
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.
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.