The most over-engineered environment variable reader in the history of Go programming. A full-blown, battle-tested, enterprise-grade package that reads ONE environment variable and tells you if you're in prod or dev.
Because os.Getenv("ENV") is 16 characters and sometimes you just need a whole fucking package to do the same thing but with ✨style✨.
- Reads the
ENVenvironment variable. That's it. That's the feature. - Defaults to
prodbecause production is where dreams go to die and that's where you probably are. - Can tell you if you're in
dev. Revolutionary. - Zero dependencies. Not even
fmt. I don't need that shit. - 100% test coverage because I'm a professional.
go get github.com/psyb0t/goenvNeeds Go 1.26 or newer.
package main
import (
"fmt"
"github.com/psyb0t/goenv"
)
func main() {
// Get the current environment
env := goenv.Get() // "prod" or "dev"
fmt.Println("running in", env)
// Check if prod
if goenv.IsProd() {
fmt.Println("don't fuck this up")
}
// Check if dev
if goenv.IsDev() {
fmt.Println("break whatever you want")
}
}export ENV=dev # you're developing
export ENV=prod # you're in production
export ENV= # also production, because paranoia is a featureOnly the exact, lowercase dev counts as dev. DEV, development, staging, a typo: all prod. The full table of values, every function and constant, and the Type alias are in the API reference.
The skill works in any agent that reads .agents/skills/ (such as peen), installs in Claude Code and Codex from the psyb0t/agents marketplace, and lands on ClawHub for OpenClaw on every release. The install commands are on Agent integrations.
The full docs live at psyb0t.github.io/goenv.
| Page | What's in it |
|---|---|
| API reference | Get, IsProd, IsDev, the constants, the Type alias and which ENV values mean dev |
| Agent integrations | Installing the skill in Claude Code, Codex and OpenClaw |
| Development | Make targets, the coverage gate, CI and releases |
Q: Do I really need a package for this? A: No. But here we are.
Q: What if I set ENV to "staging"? A: You get prod. Because if it's not explicitly dev, it's prod. I don't trust you.
Q: What about ENV=test? A: Also prod. See above.
Q: Is this thread-safe?
A: It calls os.Getenv(). Take that however you want.
Q: Why not just use os.Getenv directly? A: Because then you'd have to remember the variable name, write a switch statement, handle the default case, and before you know it you've written this package anyway.
MIT. Free as in "do whatever the hell you want with it". Which, given what this package does, isn't saying much.
