Skip to content

Commit acc0afb

Browse files
committed
Remove Relative method from Locator
The Relative method added to the Locator interface was not correctly implemented in the file type. The root was never set when instantiating the object. This change removes this method from the interface and the file type, switching to a local implementation in the mounts type instead. Signed-off-by: Evan Lezar <[email protected]>
1 parent 37ee972 commit acc0afb

File tree

2 files changed

+0
-11
lines changed

2 files changed

+0
-11
lines changed

internal/lookup/file.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import (
2828
// prefixes. The validity of a file is determined by a filter function.
2929
type file struct {
3030
logger *log.Logger
31-
root string
3231
prefixes []string
3332
filter func(string) error
3433
}
@@ -78,15 +77,6 @@ func (p file) Locate(pattern string) ([]string, error) {
7877
return filenames, nil
7978
}
8079

81-
// Relative returns the path relative to the root for the file locator
82-
func (p file) Relative(path string) (string, error) {
83-
if p.root == "" || p.root == "/" {
84-
return path, nil
85-
}
86-
87-
return filepath.Rel(p.root, path)
88-
}
89-
9080
// assertFile checks whether the specified path is a regular file
9181
func assertFile(filename string) error {
9282
info, err := os.Stat(filename)

internal/lookup/locator.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,4 @@ package lookup
2121
// Locator defines the interface for locating files on a system.
2222
type Locator interface {
2323
Locate(string) ([]string, error)
24-
Relative(string) (string, error)
2524
}

0 commit comments

Comments
 (0)