mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-19 18:02:01 +00:00
Merge pull request #114447 from yulng/elseyw
fix:Optimize code for else logic
This commit is contained in:
commit
d004f324d3
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user