From: Russ Cox Date: Thu, 25 May 2023 01:00:22 +0000 (-0400) Subject: cmd/go: show full path name (testdata/script/foo.txt) in script errors X-Git-Tag: go1.21rc1~220 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=cfe8b43b1fd453d06fc32a04746dcc8be6e955fd;p=gostls13.git cmd/go: show full path name (testdata/script/foo.txt) in script errors Showing the full path (relative to the current directory) instead of just foo.txt lets editors that understand file:line jump straight to the file without having to edit it to say testdata/script/ first. Change-Id: I44177b687249f3c7c724b45d02f5167607369e1b Reviewed-on: https://go-review.googlesource.com/c/go/+/498119 Run-TryBot: Russ Cox Reviewed-by: Ian Lance Taylor Auto-Submit: Russ Cox TryBot-Result: Gopher Robot Reviewed-by: Bryan Mills --- diff --git a/src/cmd/go/script_test.go b/src/cmd/go/script_test.go index eac365bd7d..f7829cb918 100644 --- a/src/cmd/go/script_test.go +++ b/src/cmd/go/script_test.go @@ -151,7 +151,11 @@ func TestScript(t *testing.T) { } } - scripttest.Run(t, engine, s, filepath.Base(file), bytes.NewReader(a.Comment)) + // Note: Do not use filepath.Base(file) here: + // editors that can jump to file:line references in the output + // will work better seeing the full path relative to cmd/go + // (where the "go test" command is usually run). + scripttest.Run(t, engine, s, file, bytes.NewReader(a.Comment)) }) } }