mirror of
https://github.com/gravitational/teleport.git
synced 2026-11-04 02:21:02 +08:00
If the newly created config.yaml didnt exist we would load the default values and continue the flow However, we were not resetting the `err`'s value and would have an ERROR message at the end and an invalid exit code Most of the commands would reset that variable to the output of the command's execution One of them was not: `tsh version` The version command has no return value, so the program would execute as expected until the last statement: `trace.Wrap(error)` which would re-use the `err` variable whose value is the result of the `loadConfig` method. We could either reset the `err`s value inside the `PrintVersion` switch case block or reset it right after we check for `IsNotFound`. We ended up picking the first option as it seems cleaner ``` # before $ make full > /dev/null; build/tsh version Teleport v10.0.0-dev git:v8.0.0-alpha.1-899-g335adf1f4 go1.18 ERROR: open /home/marco/.tsh/config/config.yaml: no such file or directory # after $ make full > /dev/null; build/tsh version Teleport v10.0.0-dev git:v8.0.0-alpha.1-899-g335adf1f4 go1.18 ```