mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-20 18:31:15 +00:00
Merge pull request #114447 from yulng/elseyw
fix:Optimize code for else logic
This commit is contained in:
commit
d004f324d3
@ -207,13 +207,13 @@ func loadProfiles(path string) error {
|
|||||||
// If the given fileinfo is a symlink, return the FileInfo of the target. Otherwise, return the
|
// If the given fileinfo is a symlink, return the FileInfo of the target. Otherwise, return the
|
||||||
// given fileinfo.
|
// given fileinfo.
|
||||||
func resolveSymlink(basePath string, entry os.DirEntry) (os.FileInfo, error) {
|
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)
|
return nil, fmt.Errorf("error getting the fileInfo: %v", err)
|
||||||
} else {
|
}
|
||||||
if info.Mode()&os.ModeSymlink == 0 {
|
if info.Mode()&os.ModeSymlink == 0 {
|
||||||
// Not a symlink.
|
// Not a symlink.
|
||||||
return info, nil
|
return info, nil
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fpath := filepath.Join(basePath, entry.Name())
|
fpath := filepath.Join(basePath, entry.Name())
|
||||||
|
Loading…
Reference in New Issue
Block a user