Skip to content

ffenv: report scanner errors - #160

Open
dailyun wants to merge 1 commit into
peterbourgon:mainfrom
dailyun:codex/ffenv-scanner-errors
Open

dailyun wants to merge 1 commit into
peterbourgon:mainfrom
dailyun:codex/ffenv-scanner-errors

Conversation

@dailyun

@dailyun dailyun commented Oct 20, 2026

Copy link
Copy Markdown

ffenv.Parse returns nil after its scanner stops, even when it stopped on a read error or an overlong line. A partially read .env file can therefore be accepted as successful configuration.

Return s.Err(), as ff.PlainParser already does. Clean EOF still succeeds; a read failure is returned to the caller instead of being discarded.

Added four cases: a reader failing immediately, a reader failing after a valid setting, a line exceeding the scanner limit, and clean EOF without a trailing newline. The first three fail on the base; all four pass with this change.

Validation on Go 1.26.7 / macOS arm64:

  • Full go test -race ./..., go vet ./..., and staticcheck pass.
  • gofmt, gofumpt, the parallel-test lint script, and git diff --check pass.
  • Revive reports three existing warnings in unchanged files; no new warnings.

No dependencies or scanner size limits change. Settings processed before a reader failure remain applied; this change reports that failure rather than adding rollback.

AI assistance: implemented and tested with OpenAI Codex; no human review before submission.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant