Skip to content
This repository was archived by the owner on Sep 9, 2020. It is now read-only.

Commit a6ad0cc

Browse files
committed
gps: handle symlinks properly
We now delete anything that looks like a symlink if its called "vendor" while pruning. Hopefully, you didn't make a bad decision by relying on the magical properties of symlinks. Signed-off-by: Ibrahim AshShohail <[email protected]>
1 parent 07a486b commit a6ad0cc

File tree

2 files changed

+208
-224
lines changed

2 files changed

+208
-224
lines changed

gps/filesystem.go

+2-6
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,9 @@ func deriveFilesystemState(root string) (filesystemState, error) {
104104
l := fsLink{path: relPath}
105105

106106
l.to, err = filepath.EvalSymlinks(path)
107-
if strings.HasSuffix(err.Error(), "too many links") {
107+
if err != nil && strings.HasSuffix(err.Error(), "too many links") {
108108
l.circular = true
109-
} else if err != nil {
110-
return err
111-
}
112-
113-
if _, err := os.Stat(l.to); os.IsNotExist(err) {
109+
} else if err != nil && os.IsNotExist(err) {
114110
l.broken = true
115111
} else if err != nil {
116112
return err

0 commit comments

Comments
 (0)