Bash Command-line Completion with Go

Command-line completion is a helpful feature in many modern shells, providing users with a helpful means of typing potentially complex commands quickly and accurately. In this article I show how to add completion to Go programs when run from the Bash shell.

The Magic of Go Comments

Comments are a valuable tool for documenting and communicating information about code. They are a common feature in nearly every programming language and Go is no exception. However, comments in Go programs can do far more than providing information readers of the code. In this article I will highlight some lesser known uses of comments within Go that have special – almost magical – behavior.

Using SO_PEERCRED in Go

At this year's GopherCon, Gabbi Fisher (@gabbifish) of CloudFlare made a great presentation introducing her audience to the complexities of network socket options in Go (archived video of her presentation here). In her talk, Gabbi details how to use the network socket option SO_REUSEADDR to allow multiple processes on the same server to listen on the same network port. Gabbi closes by mentioning the breadth of socket options that are available beyond just her example. Inspired by her talk, I've decided to write about the SO_PEERCRED socket option and Go.

Using Page Bundles to Organize Resources

Last year, Hugo introduced the concept of page bundles. Page bundles give website authors a new way to organize all the resources (.md files, images, etc…) of a page together. In this article, I show how I transitioned some of my existing posts to use page bundles without changing the final website layout and appearance.

Using Go Flags in Tests

Many developers are familiar with the flag package from the Go standard library. This package provides an easy method for adding command line options and argument parsing for Go programs. What may not be as well known is that flag can be used in Go unit tests as well.

Starting a Blog - Part 4: Custom Domain

One of the last steps to publishing my blog is to assign my custom domain name to it. I previously acquired the domain jbowen.dev from Google Domains and want to use that for my blog. This is supported easily by Netlify and this post details how it can be set up.

Starting a Blog - Part 3: Deploying

Following part 1 and part 2 of this series, we have now set up hugo locally, created our first post and customized our theme to match our desired appearance. Next step is to deploy our content to a webserver so it is accessible to the outside world.

Starting a Blog - Part 2: Customization

This is the second part of my blog feature on setting up a blog using Hugo and Netlify. In part 1, I discussed installing Hugo and the Hyde theme and adding an initial post. We then used the hugo server command to create a live version of the website to view locally. This post will discuss various means on how to customize the appearance of the generated blog.

Starting a Blog - Part 1: Hugo

This is the first of several posts that will discuss how to set up a new blog using Hugo and Netlify. I will discuss the steps taken to create this blog and publish it to a custom domain.

About Me

My name is James Bowen and I am a software developer and engineering manager living in Silicon Valley.

Shortlinks The shortlinks directory contains simple markdown files to create aliases to URLs that may (or may not) be hosted in this domain. Inspired by https://npf.io/2016/10/vanity-imports-with-hugo/. Creating a Shortlink Create a markdown file with the name of the shortlink in the directory. For example, wish.md. Within the file, create a front matter section containing a redirect parameter with the desired URL. A title parameter can be used to comment on the URL destination but this will not be visible to anyone following the link: