From 516099a6aa8259da4d09b4e7540935052d2dbf5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Thu, 29 Jan 2026 11:24:17 +0000 Subject: [PATCH] pkg/path: remove osInfo.HasPrefix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We seem to have imported this deprecated API from Go back in 2020, when that was entirely unnecessary at the time. We don't have any tests nor documentation for it. The good news is that we never exported any of the OS types in Go, nor did we expose a HasPrefix func for CUE importers like we did with IsAbs and others. Hence, I assume this is an entirely backwards compatible change. Signed-off-by: Daniel Martí Change-Id: I2a23d4aa7d88678ae922d579b9f68a21c6d60f72 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1230077 Unity-Result: CUE porcuepine Reviewed-by: Matthew Sackman TryBot-Result: CUEcueckoo --- pkg/path/os.go | 1 - pkg/path/path_nix.go | 8 -------- pkg/path/path_p9.go | 8 -------- pkg/path/path_win.go | 11 ----------- 4 files changed, 28 deletions(-) diff --git a/pkg/path/os.go b/pkg/path/os.go index f55193977..6eb640d10 100644 --- a/pkg/path/os.go +++ b/pkg/path/os.go @@ -41,7 +41,6 @@ type osInfo interface { splitList(path string) []string volumeNameLen(path string) int IsAbs(path string) (b bool) - HasPrefix(p, prefix string) bool join(elem []string) string sameWord(a, b string) bool } diff --git a/pkg/path/path_nix.go b/pkg/path/path_nix.go index eb1b193af..726f85eae 100644 --- a/pkg/path/path_nix.go +++ b/pkg/path/path_nix.go @@ -44,14 +44,6 @@ func (o unixInfo) volumeNameLen(path string) int { return 0 } -// HasPrefix exists for historical compatibility and should not be used. -// -// Deprecated: HasPrefix does not respect path boundaries and -// does not ignore case when required. -func (o unixInfo) HasPrefix(p, prefix string) bool { - return strings.HasPrefix(p, prefix) -} - func (o unixInfo) splitList(path string) []string { if path == "" { return []string{} diff --git a/pkg/path/path_p9.go b/pkg/path/path_p9.go index f3379ea5f..961539aa0 100644 --- a/pkg/path/path_p9.go +++ b/pkg/path/path_p9.go @@ -42,14 +42,6 @@ func (o plan9Info) volumeNameLen(path string) int { return 0 } -// HasPrefix exists for historical compatibility and should not be used. -// -// Deprecated: HasPrefix does not respect path boundaries and -// does not ignore case when required. -func (o plan9Info) HasPrefix(p, prefix string) bool { - return strings.HasPrefix(p, prefix) -} - func (o plan9Info) splitList(path string) []string { if path == "" { return []string{} diff --git a/pkg/path/path_win.go b/pkg/path/path_win.go index 054ae28aa..d854498d9 100644 --- a/pkg/path/path_win.go +++ b/pkg/path/path_win.go @@ -116,17 +116,6 @@ func (os windowsInfo) volumeNameLen(path string) int { return 0 } -// HasPrefix exists for historical compatibility and should not be used. -// -// Deprecated: HasPrefix does not respect path boundaries and -// does not ignore case when required. -func (os windowsInfo) HasPrefix(p, prefix string) bool { - if strings.HasPrefix(p, prefix) { - return true - } - return strings.HasPrefix(strings.ToLower(p), strings.ToLower(prefix)) -} - func (os windowsInfo) splitList(path string) []string { // The same implementation is used in LookPath in os/exec; // consider changing os/exec when changing this. -- 2.51.2