Skip to content

Commit

Permalink
symlink: rename variables
Browse files Browse the repository at this point in the history
Rename cleanP, fullP -> pClean, pFull.

This is mostly to silence codespell, which thinks cleanP is a typo in
cleanup. Kind of makes sense.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
  • Loading branch information
kolyshkin committed Oct 10, 2024
1 parent 78c110b commit 557b9b5
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions symlink/fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,15 +110,15 @@ func evalSymlinksInScope(path, root string) (string, error) {
// into "/b/../c" which then gets filepath.Cleaned into "/c" and then
// root gets prepended and we Clean again (to remove any trailing slash
// if the first Clean gave us just "/")
cleanP := filepath.Clean(string(filepath.Separator) + b.String() + p)
if isDriveOrRoot(cleanP) {
pClean := filepath.Clean(string(filepath.Separator) + b.String() + p)
if isDriveOrRoot(pClean) {
// never Lstat "/" itself, or drive letters on Windows
b.Reset()
continue
}
fullP := filepath.Clean(root + cleanP)
pFull := filepath.Clean(root + pClean)

fi, err := os.Lstat(fullP)
fi, err := os.Lstat(pFull)
if os.IsNotExist(err) {
// if p does not exist, accept it
b.WriteString(p)
Expand All @@ -135,7 +135,7 @@ func evalSymlinksInScope(path, root string) (string, error) {
}

// it's a symlink, put it at the front of path
dest, err := os.Readlink(fullP)
dest, err := os.Readlink(pFull)
if err != nil {
return "", err
}
Expand Down

0 comments on commit 557b9b5

Please sign in to comment.