Greetings in the Terminal with Go
August 20, 2025
A first little wee Go application
I have finally bit the bullet and started building things in a statically typed, compiled language. This one is just printing out some text in my terminal when I open a new instance, but you need to start somewhere with these things.
Goings on in here include standard library imports, a couple functions, and getting familiar with Go's slightly weird template string syntax (wherein you pass extra args to Printf
, then signal them in the string with a %
sign followed by an indicator of the type involved, which is s
for string in this case). So my today()
func which outputs a string
can be passed in to Printf
and used with %s
.
Another curveball is date-time formatting. Coming from date-fns
in Typescript (where you might call format(yourDate, 'mmm dd yyyy')
or something), it's truly odd to me that to format the date in the style of "Monday, January 2", you pass in a ... "Monday, January 2"
. This is a 'reference date' that indicates the form that format
will follow. Any day of the year will take the format of "full-day, full-month day number". You can trim "Monday" down to "Mon" and get results like "Thu", "Tue" and so on.