what
- Update custom commands
- Refactor custom commands code
why
- When parsing and executing CLI custom commands, clone the command struct into a local variable because of the automatic closure in the
Run
function of the Cobra command (the last processed command config affects all the previous ones). Cloning will make a closure over the local variable which is different in each iteration (we cloned just Go slices before, but we need to clone Go maps as well, so we clone the whole struct instead)