From 79559c1e7e426415ea8c7920c36b2fb4ebd7dbf0 Mon Sep 17 00:00:00 2001 From: Damien Neil Date: Tue, 29 Nov 2022 20:07:02 -0500 Subject: path/filepath: make Join("c:", "/a") return "c:/a" again Historically, on Windows filepath.Join("c:", elt) does not insert a path separator between "c:" and elt, but preserves leading slashes in elt. Restore this behavior, which was inadvertently changed by CL 444280. Fixes #56988 Change-Id: Id728bf311f4093264f8c067d8b801ea9ebef5b5f Reviewed-on: https://go-review.googlesource.com/c/go/+/453497 Reviewed-by: Bryan Mills TryBot-Result: Gopher Robot Auto-Submit: Bryan Mills Reviewed-by: Roland Shoemaker Run-TryBot: Damien Neil --- src/path/filepath/path_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/path/filepath/path_test.go') diff --git a/src/path/filepath/path_test.go b/src/path/filepath/path_test.go index 41e70c2dbe..6647444852 100644 --- a/src/path/filepath/path_test.go +++ b/src/path/filepath/path_test.go @@ -353,7 +353,8 @@ var winjointests = []JoinTest{ {[]string{`C:`, ``, ``, `b`}, `C:b`}, {[]string{`C:`, ``}, `C:.`}, {[]string{`C:`, ``, ``}, `C:.`}, - {[]string{`C:`, ``, `\a`}, `C:a`}, + {[]string{`C:`, `\a`}, `C:\a`}, + {[]string{`C:`, ``, `\a`}, `C:\a`}, {[]string{`C:.`, `a`}, `C:a`}, {[]string{`C:a`, `b`}, `C:a\b`}, {[]string{`C:a`, `b`, `d`}, `C:a\b\d`}, -- cgit v1.3