aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBryan C. Mills <bcmills@google.com>2020-10-16 14:01:04 -0400
committerBryan C. Mills <bcmills@google.com>2020-10-16 18:54:38 +0000
commit570b49d6fc8d66e5bcb7645dfe2a3f9a118dbf0f (patch)
tree5a19b75882dfac72ac602256a7f51af34c9bd741 /src
parent03f181a90ef4de680a666ca86c7988915e892e8c (diff)
downloadgo-570b49d6fc8d66e5bcb7645dfe2a3f9a118dbf0f.tar.xz
cmd/go: normalize paths in TestScript/build_overlay
Fixes #42008 Change-Id: I1652e8cc4e72b4b7e52571ab12da29e717218a0b Reviewed-on: https://go-review.googlesource.com/c/go/+/263145 Trust: Bryan C. Mills <bcmills@google.com> Trust: Jay Conrod <jayconrod@google.com> Run-TryBot: Bryan C. Mills <bcmills@google.com> Reviewed-by: Jay Conrod <jayconrod@google.com> TryBot-Result: Go Bot <gobot@golang.org>
Diffstat (limited to 'src')
-rw-r--r--src/cmd/go/testdata/script/build_overlay.txt33
1 files changed, 19 insertions, 14 deletions
diff --git a/src/cmd/go/testdata/script/build_overlay.txt b/src/cmd/go/testdata/script/build_overlay.txt
index 5f598f37e7..3c14e0b558 100644
--- a/src/cmd/go/testdata/script/build_overlay.txt
+++ b/src/cmd/go/testdata/script/build_overlay.txt
@@ -51,7 +51,7 @@ go 1.16
package dir2
func PrintMessage() {
- printMessage()
+ printMessage()
}
-- m/dir/foo.txt --
The build action code currently expects the package directory
@@ -61,12 +61,12 @@ TODO(matloob): Remove this requirement.
the actual code is in the overlay
-- m/overlay.json --
{
- "Replace": {
- "f.go": "overlay/f.go",
- "dir/g.go": "overlay/dir_g.go",
- "dir2/i.go": "overlay/dir2_i.go",
- "printpath/main.go": "overlay/printpath.go"
- }
+ "Replace": {
+ "f.go": "overlay/f.go",
+ "dir/g.go": "overlay/dir_g.go",
+ "dir2/i.go": "overlay/dir2_i.go",
+ "printpath/main.go": "overlay/printpath.go"
+ }
}
-- m/overlay/f.go --
package main
@@ -74,7 +74,7 @@ package main
import "m/dir2"
func main() {
- dir2.PrintMessage()
+ dir2.PrintMessage()
}
-- m/overlay/dir_g.go --
package dir
@@ -82,19 +82,24 @@ package dir
import "fmt"
func PrintMessage() {
- fmt.Println("hello")
+ fmt.Println("hello")
}
-- m/overlay/printpath.go --
package main
import (
- "fmt"
- "runtime"
+ "fmt"
+ "path/filepath"
+ "runtime"
)
func main() {
- _, file, _, _ := runtime.Caller(0)
- fmt.Println(file)
+ _, file, _, _ := runtime.Caller(0)
+
+ // Since https://golang.org/cl/214286, the runtime's debug paths are
+ // slash-separated regardless of platform, so normalize them to system file
+ // paths.
+ fmt.Println(filepath.FromSlash(file))
}
-- m/overlay/dir2_i.go --
package dir2
@@ -102,5 +107,5 @@ package dir2
import "m/dir"
func printMessage() {
- dir.PrintMessage()
+ dir.PrintMessage()
}