From: Alex Brainman Date: Fri, 8 Aug 2014 00:09:31 +0000 (+1000) Subject: os: simplify windows Getwd (fixes build) X-Git-Tag: go1.4beta1~874 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=6fb2a05ac9f6b4063f1c952df069871e9e6796d9;p=gostls13.git os: simplify windows Getwd (fixes build) Current version of Getwd calls Stat that calls Getwd therefore infinite recursion. LGTM=minux R=golang-codereviews, minux CC=golang-codereviews https://golang.org/cl/119600043 --- diff --git a/src/pkg/os/getwd.go b/src/pkg/os/getwd.go index eacb414660..d5da53b34b 100644 --- a/src/pkg/os/getwd.go +++ b/src/pkg/os/getwd.go @@ -5,6 +5,7 @@ package os import ( + "runtime" "sync" "syscall" ) @@ -23,6 +24,10 @@ var useSyscallwd = func(error) bool { return true } // reached via multiple paths (due to symbolic links), // Getwd may return any one of them. func Getwd() (dir string, err error) { + if runtime.GOOS == "windows" { + return syscall.Getwd() + } + // Clumsy but widespread kludge: // if $PWD is set and matches ".", use it. dot, err := Stat(".")