GoLang

Advent of code 2021

I’ve once again had fun with Advent of code. I’m still using it as a motivation to learn and be better at programming Go(lang). Here are some observations from the challenge rund this year: The hardest challenges was more often in understanding the task and make sure all rules was understood correctly. Despite Go (1.17) being a small language, it has all needed to solve any of the challenges. While I may not write Idiomatic Go - I do write readable code - even for people who don’t know Golang.

Looping thorugh the Alphabet in GoLang

In a recent Go programming task I needed to loop through the letters from a to z. I also needed the capital letter from A to Z. For-looping thorugh the letters in Go is luckily a breeze. The easiest way is just using a Rune. A Rune is an int32 which represent a unicode character. As a rune (the variable r below) is a Unicode character, it allows me to use the ToUpper() from the unicode package to find the Uppercase version of the letter.

A Hugo Image/Photo Gallery

I recently switch this site from Wordpress to Hugo - and the site with Danish content too. It was mostly easy and straight forward, but initially there was a few features missing (by the very nature of it being a static site) and some things I needed to look into once the switch had happened. One of these was a gallery function to present images (photos mostly). Gallery options…. There are various ways to have a gallery on a site, and one of the pains I had with wordpress, was changing strategies over time, which left me with several plugins needed to handle the historic gallery choices.

Posting With Hugo

Switching to Hugo caused a major change in the workflow behind the site. Wordpress comes with a full-featured backend which allows you to manage basically your entire website (if it’s Wordpress powered), but Hugo don’t. There’s no-backend admin site nor an webeditor to create and manage your posts. It doesn’t bother me. It’s a completely different workflow and I’m starting with a rough minimum flow initially untill I get a bit more expirence running Hugo.

Certificate check from Go

As the web moves more and more to HTTPS and ehanced security (such as HSTS) keeping your certificates updated and valid becomes more and more important. I’m toying with an idea of building a small webapp to monitor my small portfolio of certificates and warn me if a certificate is due to expire. As part of this, I’m slowly patching pieces together in Go and one of the small useful outcomes is a small (compilable to bin) script which prints the basic certificate details of a given domain.