Kaynağa Gözat

pkg/system: CheckSystemDriveAndRemoveDriveLetter: fix error format

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Sebastiaan van Stijn 2 yıl önce
ebeveyn
işleme
c4872b4519

+ 2 - 2
pkg/system/path_windows.go

@@ -10,13 +10,13 @@ import (
 // of CheckSystemDriveAndRemoveDriveLetter
 // of CheckSystemDriveAndRemoveDriveLetter
 func checkSystemDriveAndRemoveDriveLetter(path string) (string, error) {
 func checkSystemDriveAndRemoveDriveLetter(path string) (string, error) {
 	if len(path) == 2 && string(path[1]) == ":" {
 	if len(path) == 2 && string(path[1]) == ":" {
-		return "", fmt.Errorf("No relative path specified in %q", path)
+		return "", fmt.Errorf("no relative path specified in %q", path)
 	}
 	}
 	if !filepath.IsAbs(path) || len(path) < 2 {
 	if !filepath.IsAbs(path) || len(path) < 2 {
 		return filepath.FromSlash(path), nil
 		return filepath.FromSlash(path), nil
 	}
 	}
 	if string(path[1]) == ":" && !strings.EqualFold(string(path[0]), "c") {
 	if string(path[1]) == ":" && !strings.EqualFold(string(path[0]), "c") {
-		return "", fmt.Errorf("The specified path is not on the system drive (C:)")
+		return "", fmt.Errorf("the specified path is not on the system drive (C:)")
 	}
 	}
 	return filepath.FromSlash(path[2:]), nil
 	return filepath.FromSlash(path[2:]), nil
 }
 }

+ 3 - 3
pkg/system/path_windows_test.go

@@ -11,7 +11,7 @@ import (
 func TestCheckSystemDriveAndRemoveDriveLetter(t *testing.T) {
 func TestCheckSystemDriveAndRemoveDriveLetter(t *testing.T) {
 	// Fails if not C drive.
 	// Fails if not C drive.
 	_, err := CheckSystemDriveAndRemoveDriveLetter(`d:\`)
 	_, err := CheckSystemDriveAndRemoveDriveLetter(`d:\`)
-	if err == nil || err.Error() != "The specified path is not on the system drive (C:)" {
+	if err == nil || err.Error() != "the specified path is not on the system drive (C:)" {
 		t.Fatalf("Expected error for d:")
 		t.Fatalf("Expected error for d:")
 	}
 	}
 
 
@@ -68,7 +68,7 @@ func TestCheckSystemDriveAndRemoveDriveLetter(t *testing.T) {
 	if path, err = CheckSystemDriveAndRemoveDriveLetter(`c:`); err == nil {
 	if path, err = CheckSystemDriveAndRemoveDriveLetter(`c:`); err == nil {
 		t.Fatalf("c: should fail")
 		t.Fatalf("c: should fail")
 	}
 	}
-	if err.Error() != `No relative path specified in "c:"` {
+	if err.Error() != `no relative path specified in "c:"` {
 		t.Fatalf(path, err)
 		t.Fatalf(path, err)
 	}
 	}
 
 
@@ -76,7 +76,7 @@ func TestCheckSystemDriveAndRemoveDriveLetter(t *testing.T) {
 	if path, err = CheckSystemDriveAndRemoveDriveLetter(`d:`); err == nil {
 	if path, err = CheckSystemDriveAndRemoveDriveLetter(`d:`); err == nil {
 		t.Fatalf("c: should fail")
 		t.Fatalf("c: should fail")
 	}
 	}
-	if err.Error() != `No relative path specified in "d:"` {
+	if err.Error() != `no relative path specified in "d:"` {
 		t.Fatalf(path, err)
 		t.Fatalf(path, err)
 	}
 	}
 }
 }