aboutsummaryrefslogtreecommitdiff
path: root/src/path
diff options
context:
space:
mode:
authorAndy Pan <panjf2000@gmail.com>2024-02-16 13:53:05 +0800
committerGopher Robot <gobot@golang.org>2024-02-23 23:50:06 +0000
commite80385781397dc68894d4e8f2ae6741059eb9d9c (patch)
tree02c400cf70b1bfae256c20c8488d7ff0c22d1387 /src/path
parentb899e0b8cc1afc4534758c9ebe1e051e5220bfbd (diff)
downloadgo-e80385781397dc68894d4e8f2ae6741059eb9d9c.tar.gz
go-e80385781397dc68894d4e8f2ae6741059eb9d9c.zip
path/filepath: delete the deprecated joinNonEmpty and isUNC
Change-Id: I4ce88b2e8e8d24afb63ca7246ce0c418fcb02c9e Reviewed-on: https://go-review.googlesource.com/c/go/+/564715 Reviewed-by: Damien Neil <dneil@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Damien Neil <dneil@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'src/path')
-rw-r--r--src/path/filepath/path_windows.go40
1 files changed, 0 insertions, 40 deletions
diff --git a/src/path/filepath/path_windows.go b/src/path/filepath/path_windows.go
index eacab0e5ce..6adb7d4bc4 100644
--- a/src/path/filepath/path_windows.go
+++ b/src/path/filepath/path_windows.go
@@ -277,46 +277,6 @@ func join(elem []string) string {
return Clean(b.String())
}
-// joinNonEmpty is like join, but it assumes that the first element is non-empty.
-func joinNonEmpty(elem []string) string {
- if len(elem[0]) == 2 && elem[0][1] == ':' {
- // First element is drive letter without terminating slash.
- // Keep path relative to current directory on that drive.
- // Skip empty elements.
- i := 1
- for ; i < len(elem); i++ {
- if elem[i] != "" {
- break
- }
- }
- return Clean(elem[0] + strings.Join(elem[i:], string(Separator)))
- }
- // The following logic prevents Join from inadvertently creating a
- // UNC path on Windows. Unless the first element is a UNC path, Join
- // shouldn't create a UNC path. See golang.org/issue/9167.
- p := Clean(strings.Join(elem, string(Separator)))
- if !isUNC(p) {
- return p
- }
- // p == UNC only allowed when the first element is a UNC path.
- head := Clean(elem[0])
- if isUNC(head) {
- return p
- }
- // head + tail == UNC, but joining two non-UNC paths should not result
- // in a UNC path. Undo creation of UNC path.
- tail := Clean(strings.Join(elem[1:], string(Separator)))
- if head[len(head)-1] == Separator {
- return head + tail
- }
- return head + string(Separator) + tail
-}
-
-// isUNC reports whether path is a UNC path.
-func isUNC(path string) bool {
- return len(path) > 1 && isSlash(path[0]) && isSlash(path[1])
-}
-
func sameWord(a, b string) bool {
return strings.EqualFold(a, b)
}