Skip to content

Articles

Allowing flags anywhere on the CLI

Writing CLIs in Go is great, but there's one annoyance with the stdlib flag package:

flags must be defined before any positional arguments.

For example, if you have a --debug flag, you can't use it after a positional argument, it'll be treated as a 2nd positional argument.

# ✅ Works as expeceted
$ mycli --debug run

# ❌ Does not work as expected
$ mycli run --debug

Lesser-known but useful buf commands

The buf CLI is a multipurpose tool for working with Protocol Buffers. The core features include linting, formatting, breaking change detection, code generation, dependency management, etc.

But the goal of this post is to highlight some of the lesser-known commands I've personally found useful. Emphasis on personally. This is an evolving post of the lesser-known buf commands and notes on how I use them.

Finally, a blogging setup I like

Native blog support recently landed in Material for MkDocs 🎉. This is huge, because technical documentation + blog can co-exist in the same place and actually look nice!

Kudos to Martin (@squidfunk on ) for the hard work and dedication to the project. I've been following the project for a while and it's been a pleasure to watch it grow. I've used my fair share of documentation frameworks and tools, but I keep coming back to this one because...

Shine on you crazy interface

Go's interfaces are brilliant. It's not immediately apparent and at first can be confusing, but after a while its brilliance shines through.

TL;DR - if a concrete type has the necessary behavior (methods) to satisfy an interface, it can implicitly implement that interface.

Capture the Flag - Coffee

Challenge:

You found a suspicious USB drive in a jar of pickles. It contains this file

$ file freeThePickles.class
freeThePickles.class: compiled Java class data, version 52.0 (Java 1.8)

Hint: Is there a way to get the source of the program?