]> Cypherpunks repositories - gostls13.git/commitdiff
os.Getwd: wrap error on windows and plan9
authorKir Kolyshkin <kolyshkin@gmail.com>
Mon, 19 Aug 2024 20:08:32 +0000 (13:08 -0700)
committerGopher Robot <gobot@golang.org>
Mon, 19 Aug 2024 21:44:08 +0000 (21:44 +0000)
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>
src/os/getwd.go

index 90604cf2f4b18e57a04cdcf5f559b61a0ef0be3e..64c3c4acd7e02e77c0421d641c1a6b7f3d5374bc 100644 (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: