From 2e0a6f855b9af3441347b1b430e5a5e6f82a37fa Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Mon, 19 Aug 2024 13:08:32 -0700 Subject: [PATCH] os.Getwd: wrap error on windows and plan9 The errors from os are supposed to be wrapped to add some context, but in this particular case a raw syscall error is returned. Change-Id: I1b98dbd7b385c5c1cea79a1b0ec7201ca9bdca40 Reviewed-on: https://go-review.googlesource.com/c/go/+/606657 LUCI-TryBot-Result: Go LUCI Reviewed-by: Ian Lance Taylor Auto-Submit: Ian Lance Taylor Reviewed-by: Cherry Mui --- src/os/getwd.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/os/getwd.go b/src/os/getwd.go index 90604cf2f4b..64c3c4acd7e 100644 --- a/src/os/getwd.go +++ b/src/os/getwd.go @@ -21,7 +21,8 @@ var getwdCache struct { // Getwd may return any one of them. func Getwd() (dir string, err error) { if runtime.GOOS == "windows" || runtime.GOOS == "plan9" { - return syscall.Getwd() + dir, err = syscall.Getwd() + return dir, NewSyscallError("getwd", err) } // Clumsy but widespread kludge: