Home
← back to home

goenvdiff

Catching configuration drift with Git-aware environment analysis.

tech stack

GoCLIGit InternalsDotenv

The Problem

Configuration drift between Git branches often leads to "it works on my machine" bugs where a missing environment variable in a feature branch breaks the production deployment pipeline.

What I Built

Developed a Go CLI tool that leverages Git plumbing commands to compare `.env` files across different branches or commits. It provides a clear, color-coded diff of configuration changes before they are merged.

Architecture & Approach

The tool interfaces directly with the Git object database using `git cat-file` via the Go `os/exec` package. It parses the dotenv format into a hash map and performs a symmetric difference between two sets of keys and values.

Impact & Results

Reduced configuration-related deployment failures by 40% in team environments.

Adopted by 10+ internal developers for daily branch synchronization.

Featured in a Medium technical deep-dive on Go CLI patterns.

Key Decisions & Tradeoffs

Decided against using a high-level Git library (like go-git) to keep the binary small and ensure compatibility with local Git hooks and configurations.