When using --split-exp to split documents into per-file outputs, yq
silently overwrites any pre-existing files at the target paths because
os.Create truncates. For workflows that generate filenames from input
data (e.g. '.metadata.name + ".yml"'), this can clobber unrelated files
when two documents map to the same name, or when a target path collides
with something already on disk.
This change adds an opt-in --split-exp-no-overwrite flag (and a
matching yqlib constructor NewMultiPrinterWriterWithOptions) that uses
O_WRONLY|O_CREATE|O_EXCL so existing files are left untouched and yq
exits with a clear error message instead.
The default behaviour (overwrite) is unchanged; the original
NewMultiPrinterWriter constructor still exists and now delegates to the
new options-aware constructor with noOverwrite=false.
Fixes#2028
* feat: K8S KYAML output format support
Reference: https://github.com/kubernetes/enhancements/blob/master/keps/sig-cli/5295-kyaml/README.md
Co-authored-by: Codex <codex@openai.com>
Generated-with: OpenAI Codex CLI (partial)
Signed-off-by: Robin H. Johnson <rjohnson@coreweave.com>
* build: gomodcache/gocache should not be committed
Signed-off-by: Robin H. Johnson <rjohnson@coreweave.com>
* chore: fix spelling of behaviour
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
* build: pass GOFLAGS to docker to support buildvcs=false
In trying to develop the KYAML support, various tests gave false
positive results because they made assumptions about Git functionality
Make it possible to avoid that by passing GOFLAGS='-buildvcs=false' to
to Makefile.
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
* doc: cover documentScenarios for tests
Signed-off-by: Robin H. Johnson <rjohnson@coreweave.com>
* build: exclude go caches from gosec
Without tuning, gosec scans all of the vendor/gocache/gomodcache, taking
several minutes (3m35 here), whereas the core of the yq takes only 15
seconds to scan.
If we intend to remediate upstream issues in future; add a seperate
target to scan those.
Signed-off-by: Robin H. Johnson <rjohnson@coreweave.com>
---------
Signed-off-by: Robin H. Johnson <rjohnson@coreweave.com>
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
Co-authored-by: Codex <codex@openai.com>
- Add missing package manager (scoop)
- Improve winget installationn example & add link to reference documentation
- Add link to missing reference documentation for chocolatey