Skip to content

Latest commit

 

History

History
61 lines (42 loc) · 1.49 KB

File metadata and controls

61 lines (42 loc) · 1.49 KB

hotenv Implementation

Overview

This project implements hotenv, a tool for caching environment variables in a local per-session server. The full specification is in SPEC.md.

Technology Stack

  • Language: Go
  • CLI Framework: Kong (github.com/alecthomas/kong)
  • Testing: testscript (for CLI integration tests)

Project Structure

.
├── hotenv.go          # Main implementation (single file)
├── hotenv_test.go     # Test harness (TestScript)
├── tests/*.txtar      # Tests
└── SPEC.md            # Early specification (might be outdated)

Implementation Notes

Main File (hotenv.go)

The entire program is implemented in a single Go file with:

  • Kong CLI definition with all subcommands and flags
  • Complete implementation of all hotenv functionality
  • Comments to guide code reviewers through the implementation

Running Tests

Run all tests (hotenv_test.go with go test).

The just check command should pass after every change. It runs:

  • Code formatting (gofmt)
  • Linting (golangci-lint)
  • All tests (with --timout 10s)

Testing Guidelines

When writing or modifying tests in tests/*.txtar:

Use Kill to Stop the Server

Avoid --timeout in tests - these slow down the test suite. Instead, use named background processes with kill to stop the server when done.

# Start server with a name
exec hotenv serve --force -q &serve&

# ... run tests ...

# Signal the named server and wait for termination
kill -INT serve
wait serve