mirror of
https://github.com/ahmetb/kubectx.git
synced 2026-07-17 01:52:32 +00:00
enc.SetIndent(0) in go.yaml.in/yaml/v3 does not produce zero indentation; instead, it falls back to the library default of 4 spaces. This caused kubectx/kubens to rewrite the entire kubeconfig with 4-space indentation on every save, drastically changing the file format from the standard 2-space format that kubectl produces. The unexpected whole-file reformatting triggered kubeconfig management tools (Docker Desktop, Rancher Desktop, corporate k8s auth helpers, etc.) that watch ~/.kube/config via FSEvents and regenerate it from their source-of-truth when they detect format changes -- discarding the namespace or context change that was just written. Changing to enc.SetIndent(2) matches kubectl's standard output format and minimises the diff on each save to only the field(s) actually changed. Fixes #499. https://claude.ai/code/session_01DfqecMkM2DGSMQU3ji1hJL