pkg/fileutils: remove named err-returns

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2024-02-10 13:22:54 +01:00
parent ab8e3da82c
commit b0f93d5283

View File

@@ -34,11 +34,14 @@ func CopyFile(src, dst string) (int64, error) {
// ReadSymlinkedDirectory returns the target directory of a symlink.
// The target of the symbolic link may not be a file.
func ReadSymlinkedDirectory(path string) (realPath string, err error) {
if realPath, err = filepath.Abs(path); err != nil {
func ReadSymlinkedDirectory(path string) (realPath string, _ error) {
var err error
realPath, err = filepath.Abs(path)
if err != nil {
return "", fmt.Errorf("unable to get absolute path for %s: %w", path, err)
}
if realPath, err = filepath.EvalSymlinks(realPath); err != nil {
realPath, err = filepath.EvalSymlinks(realPath)
if err != nil {
return "", fmt.Errorf("failed to canonicalise path for %s: %w", path, err)
}
realPathInfo, err := os.Stat(realPath)
@@ -65,7 +68,7 @@ func CreateIfNotExists(path string, isDir bool) error {
if err != nil {
return err
}
f.Close()
_ = f.Close()
}
}
return nil