mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2024-11-22 00:08:11 +00:00
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 <elezar@nvidia.com>
This commit is contained in:
parent
37ee972f74
commit
acc0afbb7a
@ -28,7 +28,6 @@ import (
|
||||
// prefixes. The validity of a file is determined by a filter function.
|
||||
type file struct {
|
||||
logger *log.Logger
|
||||
root string
|
||||
prefixes []string
|
||||
filter func(string) error
|
||||
}
|
||||
@ -78,15 +77,6 @@ func (p file) Locate(pattern string) ([]string, error) {
|
||||
return filenames, nil
|
||||
}
|
||||
|
||||
// Relative returns the path relative to the root for the file locator
|
||||
func (p file) Relative(path string) (string, error) {
|
||||
if p.root == "" || p.root == "/" {
|
||||
return path, nil
|
||||
}
|
||||
|
||||
return filepath.Rel(p.root, path)
|
||||
}
|
||||
|
||||
// assertFile checks whether the specified path is a regular file
|
||||
func assertFile(filename string) error {
|
||||
info, err := os.Stat(filename)
|
||||
|
@ -21,5 +21,4 @@ package lookup
|
||||
// Locator defines the interface for locating files on a system.
|
||||
type Locator interface {
|
||||
Locate(string) ([]string, error)
|
||||
Relative(string) (string, error)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user