Did You Know That `gofmt` Emits Tabs(?!)
For God so loved his children that we finally have a programming language that has solved the tabs
v. spaces
debate!
This is truly exciting news! In recent years, I’d resigned my position to “use spaces everywhere” because of two justifications:
Spaces
are near-impossible to mess up (across all editors and programmers)Tabs
are technically control characters and “do not belong in files” (eg: you wouldn’t put^G
in your file, so why put^T
?)
However golang
bucks tradition in a particularly compelling way: Tabs
are indeed control
characters (increasing indent for control-flow modification), and due to near-ubiquitous use of gofmt
, it’s also near-impossible to mess up(!).
If you control exactly the language, the compiler, and the formatter, it’s an incredibly compelling simplification to use tabs
. Most editors “support them as expected” such that backspace and tab are commutative. This is effectively an upgrade for a moderate amount of people who were stuck backspacing over spaces.
Any misbehaving editor or stubborn user who uses spaces instead will simply get processed through the mold of gofmt
… their transgressions are short-lived and forgivable.
Small victories may lead to large victories… with the tabs
v. spaces
debate definitively settled, mayhaps we finally can move on to figuring out Elastic Tabstops.
00:47 CST | category / entries
permanent link | comments?