mirror of https://github.com/docker/cli.git
better to limit the scope of err
Signed-off-by: Will Wang <willww64@gmail.com>
This commit is contained in:
parent
40df26561b
commit
a85a37e3f3
|
@ -167,10 +167,9 @@ func (configFile *ConfigFile) Save() (retErr error) {
|
||||||
return errors.Wrap(err, "error closing temp file")
|
return errors.Wrap(err, "error closing temp file")
|
||||||
}
|
}
|
||||||
|
|
||||||
cfgFile := configFile.Filename
|
|
||||||
// Handle situations where `configFile.Filename` is a symlink, and allow for dangling symlinks
|
// Handle situations where `configFile.Filename` is a symlink, and allow for dangling symlinks
|
||||||
f, err := filepath.EvalSymlinks(cfgFile)
|
cfgFile := configFile.Filename
|
||||||
if err == nil {
|
if f, err := filepath.EvalSymlinks(cfgFile); err == nil {
|
||||||
cfgFile = f
|
cfgFile = f
|
||||||
} else if os.IsNotExist(err) {
|
} else if os.IsNotExist(err) {
|
||||||
// extract the path from the error if `cfgFile` does not exist or is a dangling symlink
|
// extract the path from the error if `cfgFile` does not exist or is a dangling symlink
|
||||||
|
|
Loading…
Reference in New Issue