From 28396ed8513a0ca41295104f1882b48ec0d5b43a Mon Sep 17 00:00:00 2001 From: Eric Hotinger Date: Mon, 1 Jul 2019 14:25:30 -0700 Subject: [PATCH] Updates the error message in GetFileSystemType to match the function's casing and exports the error. Signed-off-by: Eric Hotinger --- pkg/fs/fs_windows.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/fs/fs_windows.go b/pkg/fs/fs_windows.go index 051cf58..cf7de6d 100644 --- a/pkg/fs/fs_windows.go +++ b/pkg/fs/fs_windows.go @@ -9,12 +9,17 @@ import ( "golang.org/x/sys/windows" ) +var ( + // ErrInvalidPath is returned when the location of a file path doesn't begin with a driver letter. + ErrInvalidPath = errors.New("the path provided to GetFileSystemType must start with a drive letter") +) + // GetFileSystemType obtains the type of a file system through GetVolumeInformation. // https://msdn.microsoft.com/en-us/library/windows/desktop/aa364993(v=vs.85).aspx func GetFileSystemType(path string) (fsType string, hr error) { drive := filepath.VolumeName(path) if len(drive) != 2 { - return "", errors.New("getFileSystemType path must start with a drive letter") + return "", ErrInvalidPath } var (