Files
kubectx/internal
Claude ff863f4f1c fix: use 2-space YAML indent in Save() to match kubectl's kubeconfig format
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
2026-05-15 15:42:54 +00:00
..
2026-03-26 23:12:42 -04:00