os.Exit is going to sidestep the deferred sshClient.Close(); while I doubt that would cause problems in this particular case, it seems like something that would more generally be good to solve (e.g. perhaps all CLI functions return an exit status and are wrapped by an os.Exit())