mirror of
https://github.com/golang/go
synced 2024-11-25 20:17:57 -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:
parent
d2b6bdb035
commit
2e0a6f855b
@ -21,7 +21,8 @@ var getwdCache struct {
|
|||||||
// Getwd may return any one of them.
|
// Getwd may return any one of them.
|
||||||
func Getwd() (dir string, err error) {
|
func Getwd() (dir string, err error) {
|
||||||
if runtime.GOOS == "windows" || runtime.GOOS == "plan9" {
|
if runtime.GOOS == "windows" || runtime.GOOS == "plan9" {
|
||||||
return syscall.Getwd()
|
dir, err = syscall.Getwd()
|
||||||
|
return dir, NewSyscallError("getwd", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clumsy but widespread kludge:
|
// Clumsy but widespread kludge:
|
||||||
|
Loading…
Reference in New Issue
Block a user