PHP Boy Scout
  • Projects
    go-tool-base rust-tool-base
  • Search
Navigation bar avatar
✕

    PHPBoyScout


    Always leave the codebase better than you found it
    • A logging interface that doesn't leak its backend

      Posted on March 23, 2026

      Post thumbnail
      Post thumbnail
      TL;DR: A CLI tool wants pretty, coloured logs in a terminal. The same tool, running as a daemon in a container, wants structured JSON. If your packages import a concrete logger, switching between those two means touching every package. go-tool-base’s packages depend only on a logger.Logger interface, never a backend.... [Read More]
      Tags:
      • go
      • golang
      • go-tool-base
      • logging
      • architecture
    • Errors that tell the user what to do next

      Posted on March 22, 2026

      Post thumbnail
      Post thumbnail
      TL;DR: An error message that only states what went wrong leaves the user stuck. go-tool-base moved its error handling from go-errors to cockroachdb/errors specifically to separate two things that had been jammed together: the error’s identity, which is for the program, and its hint, which is for the human. Hints... [Read More]
      Tags:
      • go
      • golang
      • go-tool-base
      • error-handling
      • developer-experience
    • Props: the container that does the heavy lifting

      Posted on March 21, 2026

      Post thumbnail
      Post thumbnail
      TL;DR: Every command in a go-tool-base tool receives one argument: a *props.Props. It’s a dependency-injection container holding the logger, config, filesystem, assets, error handler and tool metadata. It is deliberately a concrete struct and deliberately not context.Context, because dependencies should be found by the compiler, not discovered at runtime. The... [Read More]
      Tags:
      • go
      • golang
      • go-tool-base
      • dependency-injection
      • architecture
    • Many embedded filesystems, one merged view

      Posted on March 21, 2026

      Post thumbnail
      Post thumbnail
      TL;DR: Go’s embed ships files inside your binary, but each embed.FS is an island, declared in one package. A modular CLI has many of them, and its features need to contribute to shared resources like the default config.yaml without editing a central file. props.Assets merges every registered embed.FS into one... [Read More]
      Tags:
      • go
      • golang
      • go-tool-base
      • embed
      • architecture
    • Scaffolding that respects your edits

      Posted on March 20, 2026

      Post thumbnail
      Post thumbnail
      TL;DR: A code generator that scaffolds your project is lovely on day one and a menace on day ninety, because the day you ask it to regenerate is the day it flattens every change you made. go-tool-base’s generator records a SHA-256 of every file it writes into a manifest. On... [Read More]
      Tags:
      • go
      • golang
      • go-tool-base
      • code-generation
      • developer-experience
    • ← Newer Posts
    • Older Posts →
    • Email me
    • GitHub

    Matt Cockayne  •  2026  •  phpboyscout.uk  •  Edit page

    Powered by Beautiful Jekyll