Testing and mocking stdin in Golang

Testing and mocking stdin in Golang I’ve been playing around with cobra recently, as it’s an awesome library for CLI applications. I always like CLI apps for learning a language, so I’ve been tinkering with a CLI app to interact with Terraform Enterprise’s API, which will force me to talking to external APIs, interpret the result and displaying it to the user. Testing, testing, 123 I want can show my application is tested and reliable. That’s meant I’ve been learning how to test golang. I’m used to Ruby, which has some awesome tools (Mocha, Rspec, Stubbing, Webmock etc). It’s possible to recreate that sort of experience in Golang, with tools like ginko, goconvey or golblin, but since we want to do things “The Golang way” I decided to try and stick to the most vanilla testing possible. ...

January 13, 2019 · 11 min · Peter Souter

Fixing common spelling errors with misspell

Fixing common spelling errors with misspell I’ve been writing a lot of documentation recently, so I’ve been looking at ways of detecting spelling mistakes. The main spelling tool you’ll find is Aspell, and it works fine. With a little bit of shell scripting, you can generally point it at some text and it’ll find mispellings: find ./content/source/ -maxdepth 5 -name "*.md" -exec aspell -x -c {} \; You’ll see something like this: ...

December 22, 2018 · 4 min · Peter Souter

Writing and playing with custom Terraform Providers

Writing and playing with custom Terraform Providers I’ve been digging deeper on Terraform. It’s something I’ve tinkered with in the past, but I’ve not really sat down to really use it in anger and try and tie a large project together. So, I picked something that I recently was doing manually: the configuration of a demo of Vault with the GCP backend. Right now I was doing most of the steps for that manually, and I wanted to automate the entire process, and have a fully reproducible demo environment created in GCP. That’s a larger project I’m going to blog about later, but for now I’m going to concentrate on one thing that came up that led me down a rabbit whole of creating a provider. ...

July 1, 2018 · 8 min · Peter Souter

Migrating my blog from Ghost to Hugo

The main piece of tech that I maintain myself is this blog, so I usually find time to play with it, try new technology such as Docker. Unsurprisingly, this has led it to be a little over-engineered, and I wanted something simpler. Why was I trying to figure out how to configure a database in a container for a blog that only I was maintaining? I didn’t need CMS-like functionality, if anything I needed a static site. ...

March 2, 2018 · 2 min · Peter Souter

Day 30 vdm30in30 is over!

Well, here it is, Day 30 of the #vdm30in30. Here’s some stats on the last 30 days of posts: 23,343 Words 213,374 Characters 238 Sentences 29 Paragraphs 1 hr 25 mins Reading Time 2 hrs 10 mins Speaking Time Most used words: puppet 264 (4%) provider 116 (2%) puppetlabs 93 (1%) package 90 (1%) should 87 (1%) code 85 (1%) cockpit 85 (1%) opt 84 (1%) executed 80 (1%) run 79 (1%) Not sure how accurate that is because there’s a lot of code snippets in there, but seems about right: Each post was roughly about 750 words or so. ...

November 30, 2016 · 2 min · Peter Souter