Skip to content

fix(cli): preserve output when validation fails - #77

Open
dajiaohuang wants to merge 1 commit into
a8m:masterfrom
dajiaohuang:fix/no-truncate-output-on-validation-error
Open

dajiaohuang wants to merge 1 commit into
a8m:masterfrom
dajiaohuang:fix/no-truncate-output-on-validation-error

Conversation

@dajiaohuang

Copy link
Copy Markdown

The CLI currently creates or truncates the -o destination before parsing. If -no-unset or -no-empty rejects the template, the previous output is destroyed despite no replacement being written. Parse and validate first; open the destination only after success.\n\nValidation: synthetic local CLI checks confirmed unset and empty-variable failures preserve a sentinel output, while a successful synthetic substitution writes the expected result. git diff --check passed; the repository's documented go test passed; go test -vet=off ./... passed. The additional go test ./... run reports existing non-constant format-string vet diagnostics in unchanged main.go lines.

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