Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSH config souldn't be mandatory #8

Merged
merged 3 commits into from
Feb 10, 2016
Merged

SSH config souldn't be mandatory #8

merged 3 commits into from
Feb 10, 2016

Conversation

novln
Copy link
Contributor

@novln novln commented Feb 9, 2016

IMO, SSH config souldn't be mandatory if not provided by the end-user.

log.Debugf("cannot find ssh config file: %s", path)
return sections, nil
}

log.Debugf("parsing ssh config file: %s", path)
content, err := ioutil.ReadFile(path)
if err != nil {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of doing a stat above you can just handed the IsNotExist error here that will come from ReadFile.

if err != nil {
    if os.IsNotExist(err) {
        return make(map[string]*SshConfigFileSection), nil
    }
    return nil, err
}

@novln
Copy link
Contributor Author

novln commented Feb 10, 2016

Thanks for your feedback, much better now :)

@crosbymichael
Copy link
Owner

thanks!

LGTM

crosbymichael added a commit that referenced this pull request Feb 10, 2016
SSH config souldn't be mandatory
@crosbymichael crosbymichael merged commit a16f671 into crosbymichael:master Feb 10, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants