Skip to content

Commit

Permalink
refactor(config): Remove os.Stat call
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas LE ROUX committed Feb 10, 2016
1 parent df1243d commit 8a2b80d
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,13 @@ func parseSshConfigFile(path string) (map[string]*SshConfigFileSection, error) {

sections := make(map[string]*SshConfigFileSection)

if _, err := os.Stat(path); err != nil && os.IsNotExist(err) {
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 {
if os.IsNotExist(err) {
log.Debugf("cannot find ssh config file: %s", path)
return sections, nil
}
return nil, err
}

Expand Down

0 comments on commit 8a2b80d

Please sign in to comment.