This was incorrectly ported from Rust to Go.
When `--stdin` is provided, `treefmt` copy the `stdin` into a temporary file, using the first path argument as the filename. This allows the user to control which formatters will match this temp file based on their `treefmt` config.
After the formatters have been applied, the contents of this temporary file are then printed to stdout and the temp file is removed.
Signed-off-by: Brian McGee <brian@bmcgee.ie>
This was incorrectly ported from Rust to Go.
When provided, `treefmt` will take the contents of stdin and place them into the file provided with the `--stdin` flag, then format it according to the configured formatters.
If the file doesn't exist it is created. If it exists, it is first truncated and then populated with stdin.
Signed-off-by: Brian McGee <brian@bmcgee.ie>