From 7071a8557c215725b4e03e8d64860005661ec840 Mon Sep 17 00:00:00 2001 From: yulng Date: Tue, 13 Dec 2022 20:21:09 +0800 Subject: [PATCH] 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 --- test/images/apparmor-loader/loader.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/images/apparmor-loader/loader.go b/test/images/apparmor-loader/loader.go index 4cb3ed35876..8e0e99c0419 100644 --- a/test/images/apparmor-loader/loader.go +++ b/test/images/apparmor-loader/loader.go @@ -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 // 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 - } + } + if info.Mode()&os.ModeSymlink == 0 { + // Not a symlink. + return info, nil } fpath := filepath.Join(basePath, entry.Name())