1
0
mirror of https://github.com/golang/go synced 2024-11-21 23:44:39 -07:00

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 <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
This commit is contained in:
Kir Kolyshkin 2024-08-19 13:08:32 -07:00 committed by Gopher Robot
parent d2b6bdb035
commit 2e0a6f855b

View File

@ -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: