fix:Optimize code for else logic

if block ends with a return statement, so drop this else and outdent its block

Signed-off-by: yulng <wei.yang@daocloud.io>
This commit is contained in:
yulng 2022-12-13 20:21:09 +08:00
parent f77dc4e6be
commit 7071a8557c
No known key found for this signature in database
GPG Key ID: E448671A4EBCC0CD

View File

@ -207,14 +207,14 @@ func loadProfiles(path string) error {
// If the given fileinfo is a symlink, return the FileInfo of the target. Otherwise, return the
// given fileinfo.
func resolveSymlink(basePath string, entry os.DirEntry) (os.FileInfo, error) {
if info, err := entry.Info(); err != nil {
info, err := entry.Info()
if err != nil {
return nil, fmt.Errorf("error getting the fileInfo: %v", err)
} else {
}
if info.Mode()&os.ModeSymlink == 0 {
// Not a symlink.
return info, nil
}
}
fpath := filepath.Join(basePath, entry.Name())
resolvedName, err := filepath.EvalSymlinks(fpath)