How fgm/envrun works
envrun is a small environment-file loader and command launcher. Its principal workflow parses CLI arguments, loads and validates one required environment file, merges its variables beneath inherited values, then starts the requested command. Unix replaces envrun with that command; other supported platforms supervise it. A separate Go library path lets applications apply the same file rules to their own process. The graph follows documented behavior and shown calls; some internal loader links are omitted where the excerpts do not show the call site.
Main entry points: main.go Run coordinator · env.go File loading · exec_unix.go Unix exec · exec_other.go Supervised exec
Components 13
Command launcher
- Argument parsing
main.go - Run coordinator
main.go
Environment library
- File loading
env/env.go - File parser
env/env.go - Parse errors
env/errors.go - Variable sets
env/env.go - Library Apply
env/env.go - Process export
env/env.go
Process execution
- Unix exec
exec_unix.go - Supervised exec
exec_other.go
Other components
- CLI user
- Inherited environment
- Requested command
Connections 18
- CLI user → Argument parsing: provides arguments
README.md - Argument parsing → Run coordinator: returns options
main.go - Run coordinator → File loading: loads file
main.go - File loading → File parser: parses contents
env/env.go - File parser → Parse errors: reports problems
env/errors.go - File loading → Variable sets: returns variables
env/env.go - Run coordinator → Inherited environment: reads environment
main.go - Run coordinator → Variable sets: merges variables
main.go - Run coordinator → Unix exec: dispatches to
exec_unix.go - Run coordinator → Supervised exec: dispatches to
exec_other.go - Unix exec → Requested command: replaces process
exec_unix.go - Supervised exec → Requested command: starts child
exec_other.go - Variable sets → Unix exec: supplies environment
exec_unix.go - Variable sets → Supervised exec: supplies environment
exec_other.go - CLI user → Library Apply: imports library
- Library Apply → File loading: loads file
env/env.go - Library Apply → Process export: applies variables
env/env.go - Process export → Inherited environment: sets process environment
env/env.go